Rotating a player based on a part's position (instantly)

Hello, so I’m trying to rotate a player’s character as soon as the character spawns, but it seems like the script is so fast that nothing really happens unless I put a wait(1) there but that’s just slow.
AutoLoads are disabled(players’ first spawn is when they click the player button and their next spawns are instant on the moment the player dies)

This is a server script, since the parts only load when the character has spawned in for the first time

local players = game:GetService("Players")
local checkpoints = game:WaitForChild("Workspace"):WaitForChild("Stages"):WaitForChild("CheckPoints") -- folder with stages checkpoints --

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local stage = player:WaitForChild("leaderstats"):WaitForChild("Stage") -- players' stage intvalue
		character:WaitForChild("HumanoidRootPart").CFrame *= CFrame.Angles(0, math.rad((checkpoints[stage.Value + 1].Orientation.Y)), 0) --Runs but does nothing when there's no wait(x time)
	end)
end)

Any idea on how I can make it instantly when the character spawns?

I would simply just add a task.wait() before changing the HumanoidRootPart’s CFrame. This worked for me and when the character spawns in it’s instantly turned by a set number of degrees.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.