I want it so that the server randomly generates someone as; lets say for example, murder mystery's random player selection. I tried to make my own script, but it didn't work, any ideas?
I'll just set you off here.
math.random
is used to pick a random number between what you give it, we can also use it to randomly pick a value, or element
from the table. Here's an example;
tab = {1, true, "hi", 92} randomvalue = tab[math.random(#tab)] print(randomvalue)
Random value could print anything from the table we gave it, it could print 1, true, hi, or 92. Since it's 'random' we can't actually determine that.
Now since you know math.random can pick a random value between 2 numbers, or from a table;
The method :GetPlayers()
creates a table of the players, like this:
game.Players:GetPlayers()
I think I've helped you enough (:
Like De says, use math.random. math.random has been used in many FPS and murder game. math.random is what is used when a random map has been picked out such as the early version of murder mystery. Also, if you want to use it on players, you'll have to use the method that gets players such as
game.Players:GetPlayers()
That gets the players, then you want to use math.random to pick out a random players from the mix of players, and depending on what you want to do to the players, put them on any team that suits or whatever you feel like you would like to do with them.