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

Picking one player out of many...?

Asked by 10 years ago

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

Log in to vote
1
Answered by 10 years ago

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()
0
Uhm, yeah, sorta new to scripting. Trying to learn. Will try to use this... starkiller523 65 — 10y
Ad

Answer this question