Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

Give any suggestions:)

3 answers

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.

2 comments

0

thank you!

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.

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")

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

This discussion is preserved as it was. New answers, comments, and votes are closed.