Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
|
| 04 Jul 2014 09:06 PM |
for i,plr in pairs(plrs) do if plr.Character ~= nil then lastSpawnPointUsed = lastSpawnPointUsed + 1 plr.Character:MoveTo(Map.SpawnPoints:GetChildren()[lastSpawnPointUsed].Position) end end
How would I make it more randomized? |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2014 09:07 PM |
Spawns = Map.SpawnPoints:GetChildren() plr.Characer:MoveTo(Spawns[math.random(1,#Spawns)].Position)
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
|
| 04 Jul 2014 09:12 PM |
| I fixed your mistake and it still didn't work; they don't even go to the spawns. |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2014 09:18 PM |
Huh, weird. Try this
Spawns = Map.SpawnPoints:GetChildren()
for i,plr in pairs(plrs) do if plr.Character ~= nil then plr.Character:MoveTo(Spawns[math.random(1, #Spawns)].Position) end end
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
|
| 04 Jul 2014 10:54 PM |
| It works; but now people spawn at the exact same one every time. |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2014 11:04 PM |
The General Idea Every time a script in a place uses the math.random function, the random generator generates a random number. However, the random number generator is deterministic. It uses the last random number to generate the next random number. When the scripts starts, the "first" random number is always the same. So every time the script is ran, the same random number sequence will be generated, as in the test at the top of this page.
I hate the LGBT. Those laser guided battle tanks are just too damn powerful. |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 04 Jul 2014 11:16 PM |
Spawns = Map.SpawnPoints:GetChildren()
for i,plr in pairs(plrs) do coroutine.resume(coroutine.create(function() if plr.Character ~= nil then plr.Character:MoveTo(Spawns[math.random(1, #Spawns)].Position) end end)) end siggys r stupid |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
|
| 04 Jul 2014 11:17 PM |
I achieved randomness by using
Spawns = Map.SpawnPoints:GetChildren() lastSpawnPointUsed = 0 for i,plr in pairs(plrs) do if plr.Character ~= nil then lastSpawnPointUsed = lastSpawnPointUsed + 1 plr.Character:MoveTo(Spawns[math.random(lastSpawnPointUsed, #Spawns)].Position) end end |
|
|
| Report Abuse |
|
|