I'm trying to make my script teleport the user to all players via a while true do
loop, but unfortunately it does nothing except output attempt to get length of local 'v' (a userdata value)
local lp = game.Players.LocalPlayer wait(3) for _,v in pairs(game.Players:GetChildren()) do if game:GetService("Players")[v.Name] and game:GetService("Players")[v.Name].Character then while true do local randomplayer = math.random(1,#v) lp.Character.HumanoidRootPart.CFrame = game:GetService("Players")[v.Name].Character.HumanoidRootPart.CFrame wait(1) end end end
What did I do wrong?
Try this, tell me the outcome.
local lp = game.Players.LocalPlayer wait(3) while true do for _,v in pairs(game.Players:GetChildren()) do local randomplayer = math.random(1, #v) lp.Character.HumanoidRootPart.CFrame = randomplayer.Character.HumanoidRootPart.CFrame + Vector3.new(2, 0, 0) wait(1) end end