So I have been working on an Obby type game for a while and decided to make a checkpoint system where the character respawns on a part but whenever I load into the game I'm rotated to the left like this and move in that position
and here is the script I have for the checkpoint respawing, All I know is its something to do with line 7 or 8, Please help lol been trying to fix this for like 4 hours
Lua:
game.Players.PlayerAdded:Connect(function(plr)
local stage = plr:WaitForChild("leaderstats").Stage
plr.CharacterAdded:Connect(function(char)
repeat wait() until plr.Character ~= nil
wait(0.05)
local checkpoint = game.Workspace.Stages:FindFirstChild(stage.Value)
char:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(checkpoint.Position + Vector3.new(0,100,0), checkpoint.Position)
char:FindFirstChild("HumanoidRootPart").Orientation = Vector3.new(0,0,0)
wait (0.1)
end)
end)