How Do I Make A Player Face A Certain Direction?

I wanted to make a fall boarder so when you fall off it make you teleport to a part.

Problem: When the player falls they get to the part with there camera facing the way they fall like this

I know I need to use CFrame.lookAt to make their HumanoidRootPart looking at a specific Vector3 but I do not know how to do that. Can someone help?

I am wanting the player to look like this when they fall or which ever direction they fall to look like this

-- SERVER SCRIPT INSIDE FALLBOARD
---> variables
local FallEvent = game.ReplicatedStorage.Remote.FallEvent
local MainPart = script.Parent.Main 
local PadPart = script.Parent.Pad
local debounce = false 

---> main
MainPart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if not debounce then
			debounce = true
			local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
			if plr then
				FallEvent:FireClient(plr)
				task.wait(0.5)
				hit.Parent.HumanoidRootPart.CFrame = PadPart.CFrame + Vector3.new(0,10,0)
				task.wait(1)
				debounce = false
			end
		end
	end
end)
3 Likes

How about using CFrame.new?

You can put different types of arguments, for example two of the arguments is to put two Vector3s. The first Vector3 will be the HumanoidRootPart position and the second Vector3 will be the direction the HumanoidRootPart is looking at.

You can modify those Vectors so the HumanoidRootPart doesn’t tilt.

3 Likes

how do I use the direction one

2 Likes

Do you mean the one where the player is looking at?

1 Like

Ya that one ------------------------------

1 Like

You can get the direction from the pad, but idk what direction your pad is facing.

1 Like

How do you get the direction what does the look like one a script?

Using Pad.CFrame.LookVector (that will get the normalised vector your part is facing) but that will make your character literally face to this position, making it tilt. So add it to the character HumanoidRootPart’s position and use that as a direction.

It said
Unable to assign property CFrame. CoordinateFrame expected, got Vector3
also like this

hit.Parent.HumanoidRootPart.CFrame = PadPart.CFrame.LookVector

You’re not using the CFrame correctly. You should use CFrame.new and assign it with the HumanoidRootPart’s position and the HumanoidRootPart’s position plus the LookVector.

like this

hit.Parent.HumanoidRootPart.CFrame.new = PadPart.CFrame.LookVector

or

hit.Parent.HumanoidRootPart.CFrame = PadPart.CFrame.new(LookVector)
1 Like
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, HumanoidRootPart.Position + LookVector)

Don’t take this line literally. This is just to show you the way.

I don’t know how to use that----

hit.Parent.HumanoidRootPart.CFrame = CFrame.new(hit.Parent.HumanoidRootPart.Position, hit.Parent.HumanoidRootPart.Position + PadPart.CFrame.LookVector)

Alright. This is the one you can actually use.

CFrame.lookAt(character.HumanoidRootPart.Position, Vector3.new(specificX, 0, specificZ)

That did not work--------------

I answered you here.

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