generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Make it more randomized?

Previous Thread :: Next Thread 
Krosskode is not online. 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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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 is not online. 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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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 is not online. 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
nobbers12345 is not online. nobbers12345
Joined: 06 Feb 2011
Total Posts: 4425
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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image