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

How would I create a Random Player Picker With a Timer Gui?

Asked by 10 years ago

** Is the script right? Also how would I make it select two people with a Countdown Gui that works I tried dragging the Gui in the script, but it didn't work.**

pos = 0, 0, 0 -- The position that the random player will be moved to.
WaitTime = 30 -- The time in-between each player getting picked.

dft = {} 

function GetPlayers()
local c = game.Players:GetChildren() 
for i = 1, #c do 
table.insert(dft, c[i].Name) 
end 
end

function Randomize()
GetPlayers()
local d = math.random(1, #dft) 
local s = d 
local m = Instance.new("Message", game.Workspace) 
m.Text = "The random player is ... "..dft[s].."!" 
wait(2) 
m:Remove()
local rndm = game.Players:FindFirstChild(dft[s])
if (rndm ~= nil) then 
local Player = rndm.Character
Player:MoveTo(Vector3.new(pos))
end
end

while true do
wait(WaitTime)
Randomize()
end

Answer this question