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

Picking one player out of many...?

Hi, i'm trying to figure out how to make it so in my game, it chooses one player out of all the players in a server. Like in hide and seek it chooses which player to be 'IT'. I need it to do this at the beginning of every round. How do I do this?

Oh and, heres the game i'm making... http://www.roblox.com/Demon-run-WIP-0-place?id=153483399

if 20 > 10 then
h = Instance.new("Hint", workspace)
h.Text = "Please help :3"

1 answer

✓ Accepted answer

This could be done with math.random

function Select()
	local R = math.random(1,#game:GetService("Players"):GetPlayers())
	return game:GetService("Players"):GetPlayers()[R]
end
Selected = Select()

1 comment

0

Uhm, yeah, sorta new to scripting. Trying to learn. Will try to use this...

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