I am making a automatic team choosing system and I am using :GetPlayers() to do this
I need some players to be humans and some to be zombies
however math.random is constantly repeating what do you guys suggest I do?
I am making a automatic team choosing system and I am using :GetPlayers() to do this
I need some players to be humans and some to be zombies
however math.random is constantly repeating what do you guys suggest I do?
If you're setting a variable to math.random, it will have the same value every time the script repeats. Example:
local random = math.random(1, 10)
print(random)
print(random)
-- These will both print the same thing.
What you should do is make a function for getting a random number. For example:
function getRandom(number1, number2)
return(math.random(number1, number2))
end
print(getRandom(1, 10))
print(getRandom(1, 10))
This discussion is preserved as it was. New answers, comments, and votes are closed.