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

how do i make a script that chooses a random charachter to be it?

Asked by 10 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

Give any suggestions:)

3 answers

Log in to vote
1
Answered by 10 years ago

Perhaps it would be easier to create a script that randomly takes a player out of a queue and give the player that was taken out the special effects/perks instead of selecting one from the group as a whole.

0
thank you! Chaserox 62 — 10y
1
I have found this easier in my own personal experience with my projects to make it remove someone from the queue than to add an instance for a random player already in the queue. areiydenfan00 115 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

If it is choosing a player out of the Players, then here.

local players = game.Players:GetChildren()

local RandomPlayer = players[math.random(1, #players)]
print(RandomPlayer.Name .. " Is it! :3")
Log in to vote
0
Answered by 10 years ago

This is like the one for my game "Juggernaut"

m = math.random(1, game.Players.NumPlayers) -- chooses the juggernaut
    player = game.Players:GetChildren()[m]
    if player ~= nil then
        local msg2 = Instance.new("Message")
        msg2.Parent = game.Workspace
        msg2.Text = player.Name .. " is the juggernaut!" -- says who is juggernaut
        wait(2)
        msg2:remove()
    end

Answer this question