|
| 01 Jan 2017 11:32 AM |
archerAmtlocal function spawnTower(towerType,amt,map) archerAmt = 0 for i = 1,amt,1 do local spawns = map.TowerSpawns local spawntable = {} for i,s in next,spawns:GetChildren() do table.insert(spawntable,s) end local t = spawntable[math.random(1,#spawntable)] local pos = t.Position for i,v in next,spawntable do if v == t then table.remove(spawntable,i) end end local tower = game.ServerStorage[towerType]:Clone() tower.Parent = workspace tower:MoveTo(pos) tower:MakeJoints() for i,v in next,tower:GetChildren() do if v:IsA("Part") then v.Anchored = false end if string.find(v.Name,"Noob") then archerAmt = archerAmt + 1 end end end end
it will spawn towers in the same spot
meaning my removing method is not working
not sure why
Formerly xXTheRobotXx, add 13,349 posts |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:36 AM |
oh ignore the thing at the top i pasted the wrong thing at first
Formerly xXTheRobotXx, add 13,349 posts |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:36 AM |
The roblox wiki recommends iterating over tables using ipairs so that the indexes are in numerical order.
http://wiki.roblox.com r+://169950678 |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:37 AM |
@Ultimate
that won't make a difference
Formerly xXTheRobotXx, add 13,349 posts |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:38 AM |
Oh and it'd be nice if you give us the output and give us the area of the code with the error is.
http://wiki.roblox.com |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:39 AM |
"Oh and it'd be nice if you give us the output and give us the area of the code with the error is."
there's no output
Formerly xXTheRobotXx, add 13,349 posts |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:40 AM |
| Add some print("Here?")'s in there or something to debug it and see what went wrong. Try not to use the same text the entire time though. You could do print("1"), print("2"), print("3"), etc. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:42 AM |
ok i fixed it
i just had to rearrange some stuff
thanks though guys
Formerly xXTheRobotXx, add 13,349 posts |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:43 AM |
sure, no problem
Formerly ToxicDominator - add 30,319 posts |
|
|
| Report Abuse |
|
|