local allPlayers = {}
for a,v in pairs(game.Players:GetChildren()) 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(20)
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())
This is your script, there's easier ways of doing this. Instead of having a generic for loop search through a table of all the players and insert them all into another table. You can get rid of the whole generic loop.
local allPlayers = game.Players:GetChildren()
local plrAmount = game.Players.Numplayers
local val1 = math.random(plrAmount)
local val2
repeat
val2 = val2 - math.random(plrAmount)
wait(20)
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())
1 comment
Thank you sooo much i was so confused c: