Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make people face a certain direction when they respawn on a checkpoint?

I finally got my checkpoint script working but when you respawn, you're always facing the same direction. Here is my script:

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.01)
		local checkpoint = game.Workspace.Stages:FindFirstChild(stage.Value)
		char:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(checkpoint.Position + Vector3.new(0,5,0), checkpoint.Position)
		char:FindFirstChild("HumanoidRootPart").Orientation = Vector3.new(0,0,0)
		wait(0.1)
	end)
end)

2 answers

✓ Accepted answer

[MARK THIS AS ACCEPTED IF THIS WORKS]

You can fix this by first having the correct rotation but not position and then fixing the position.

THE SCRIPT:

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.01)
		local checkpoint = game.Workspace.Stages:FindFirstChild(stage.Value)
		char:FindFirstChild("HumanoidRootPart").CFrame = checkpoint.CFrame
		char:FindFirstChild("HumanoidRootPart").Position = Vector3.new(checkpoint.Position.x, checkpoint.Position.y + 5, checkpoint.Position.z)
		wait(0.1)
	end)
end)

2 comments

0

Tysm for the help! I accepted the answer because it worked, the character faces the right way now. The only thing is the camera still faces the wrong direction. If there is a way to fix that please let me know, thanks

0

Nevermind about what I said above, the camera only faces the wrong way when you play in studio, not the actual game.

Hey, maybe all you need to do is rotate the checkpoint.

1 comment

0

No I tried that before I asked the question lol

This discussion is preserved as it was. New answers, comments, and votes are closed.