Im having trouble with the script again! sorry D:
local allPlayers = {} for a,v in pairs(game.Players:GetChildren(2)) do table.insert(allPlayers,v) end local plrAmount = game.Players.NumPlayers local val1 = math.random(plrAmount) local val2 repeat val2 = val2 - math.random(plrAmount) wait(2) until val2 ~=val1 allPlayers[val1].Character.Torso.CFrame = CFrame.new(0,0,0) allplayers[val2].Character.Torso.CFrame = CFrame.new(665.995,7.1,-115.005) math.randomseed(os.time())
it says (in output) Workspace.Script:6: bad argument #1 to 'random' (interval is empty) pls help
I switched our GetChildren() with GetPlayers(). Also moved math.randomseed to be before math.random, so the sequence generated is different each time.
local allPlayers = {} for a,v in pairs(game.Players:GetPlayers()) do table.insert(allPlayers,v) end local plrAmount = game.Players.NumPlayers math.randomseed(tick()) local val1 = math.random(plrAmount) local val2 repeat wait() val2 = math.random(plrAmount) until val2 ~=val1 allPlayers[val1].Character.Torso.CFrame = CFrame.new(0,0,0) allplayers[val2].Character.Torso.CFrame = CFrame.new(665.995,7.1,-115.005)