So i want my every player to spawn in with CFrame before the next code runs.
spawn(function()
Player.CameraMode = Enum.CameraMode.LockFirstPerson
wait(1)
character:FindFirstChild("Torso").CFrame = table.remove(AvailableSpawnPoints, math.random(#AvailableSpawnPoints)).CFrame + Vector3.new(0,10,0)
end)
end
for i = GameSettings.RoundTime, 0, -1 do
-- stuff
end
You can use a for loop to loop through all present players, and apply the CFrame to their Torso. Like so:
local Players = game:GetService("Players")
for i, Player in pairs(Players:GetPlayers()) do
-- Apply CFrame to Player.Character.Torso
end
-- Next code here
As suggested above, don’t use spawn if you want to apply the CFrame to all player torso’s before moving on. spawn will execute the function in another thread, meaning the script will move on without waiting for the loop to finish.