Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you pick one player out of all players?

Asked by
sad_eyez 162
7 years ago

i am not requesting anything, i already know quite a bit about getting players, but i need to know how i can go about picking one player to be a killer and the others to be survivors

1 answer

Log in to vote
2
Answered by 7 years ago

You can use :GetPlayers() which will give you a table containing all players, and then pick a random one with table[math.random(#table)].

[offtopic] Math.random is kinda broken, if you want it work well allways do this at the start of your scripts that use it:

math.randomseed(os.time());math.random();math.random();math.random();
0
You only need to seed once per machine, not per script. duckwit 1404 — 7y
0
Right Programical 653 — 7y
Ad

Answer this question