So, I'm making a racing game of 8 players, and I'm trying to test something to make a player teleports to a selected position. Like: Player 1 from the 8 players teleports to (0, 50 , 0) and Player 2 from the 8 players to (0, 100, 0) player 3 from 8 players to... the whole time until Player 8 has teleported to the selected position. But in my output stands: "Player1 is not a valid member of Workspace" (and other 7 too.) And here is my script:
if Wait(30) then game.Workspace.Player1.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 50, 0)) game.Workspace.Player2.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 100, 0)) game.Workspace.Player3.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 150, 0)) game.Workspace.Player4.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 200, 0)) game.Workspace.Player5.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 250, 0)) game.Workspace.Player6.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 300, 0)) game.Workspace.Player7.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 350, 0)) game.Workspace.Player8.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 400, 0)) end
I hope you can help me with this! Good luck!
-Gamer_io
You should do it like this;
local plr = game:GetService("Players"):GetPlayers() for i,v in pairs(plr) do v.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, i*50, 0) end