My game has many rounds, and in one of them I need to tp a random player to a random car. I'm afraid that it'll leave some players out, and repeat itself on other ones. I also need to put a feature in which if there are less than 3 players, the round wil not start. Here is the code: (Notice is the GUI it works)
local notice = game.Lighting.Notice
while true do
notice.Value = "Sled Race!"
pos = -233, 2.9, 136
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 = ""
wait(2)
m:Remove()
local rndm = game.Players:FindFirstChild(dft[s])
if (rndm ~= nil) then
local Player = rndm.Character
Player:MoveTo(Vector3.new(-233, 2.9, 136))
end
end
wait(2)
Randomize()
wait (30)
end
