Bubu2319
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 1006 |
|
|
| 20 Dec 2015 01:23 PM |
so im 99% sure i wrote this code right. so i think its a glitch (note: i dont know what line does this). it is suppose to spawn you on the map but it removes the map, then spawns you (you fall to your death) then regenrates the map. not sure if its this loop or another one. thoughts?
local spawnsmodel = newmap:WaitForChild("Spawns") local spawns = spawnsmodel:GetChildren() for _, player in pairs(players) do if player and player.Character and #spawns > 0 then local torso = player.Character:WaitForChild("Torso") local humanoid = player.Character:WaitForChild("Humanoid") local playerspawn = math.random(1,#spawns) local spawn = spawns[playerspawn] if torso and humanoid and spawn then humanoid.Health = 100 humanoid.WalkSpeed = 16 table.remove(spawns,playerspawn) |
|
|
| Report Abuse |
|
|
Bubu2319
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 1006 |
|
|
| 20 Dec 2015 01:23 PM |
| editor note: this is a loop so it goes on forever. |
|
|
| Report Abuse |
|
|
XIPokezIX
|
  |
| Joined: 24 Sep 2015 |
| Total Posts: 381 |
|
|
| 20 Dec 2015 01:36 PM |
| table.remove(spawns,spawns[playerspawn]) |
|
|
| Report Abuse |
|
|
Bubu2319
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 1006 |
|
|
| 20 Dec 2015 01:39 PM |
error on that line
12:38:41.099 - ServerScriptService.Script:67: bad argument #2 to 'remove' (number expected, got Object) |
|
|
| Report Abuse |
|
|
XIPokezIX
|
  |
| Joined: 24 Sep 2015 |
| Total Posts: 381 |
|
|
| 20 Dec 2015 01:54 PM |
| What exactly do you wanna remove. The model of a value from a table. |
|
|
| Report Abuse |
|
|
Bubu2319
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 1006 |
|
|
| 20 Dec 2015 01:59 PM |
| lol stupid me, i had it so it removes the spawns to early. i just had to move one line and end the function at the very instead of half way through. thanks for the help |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 02:00 PM |
Well from the looks of things, the playerspawn variable isn't being recognized as a number, which doesn't make much sense.
I could probably analyze this better if I could see the entire script. Do you know what line its specifically pointing to?
|
|
|
| Report Abuse |
|
|
Bubu2319
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 1006 |
|
|
| 20 Dec 2015 02:03 PM |
| @Clone it was a line that wasn't part of this function at all that was removing the map, I moved it down to the next function and removed an end and put it at the very bottom of the script. Now everything is running smooth. Thanks for the help though |
|
|
| Report Abuse |
|
|