How would I make one player face another?

I’m not sure how to do this.

Example:
image
On only the Y axis, player 1 faces player 2 when player 1 clicks on player 2.

Could anyone help me?

Another example:
image

I’ve tried to do this by setting the orientation of the HumanoidRootPart but it doesn’t do anything.

Could you cframe it?
Like

Local Position = HumanoidRootPart.Position
HumanoidRootPart.Cframe = Cframe.new(Position, otherPlayersRootPart.Position) — (og Position, where you want it to look)

CFraming doesn’t do anything, the orientation gets overriden by something.

Does tweening the HumanoidRootPart work?

Of course, assuming that you have already put a click detector inside the player (player.Character.ClickDetector), put a script inside the clickdetector and use this code:

script.Parent.MouseClick:Connect(function(clicker)
	local user = clicker.Character.PrimaryPart
	local userclicked = script.Parent.Parent.PrimaryPart
	user.CFrame = CFrame.lookAt(user.CFrame.Position, Vector3.new(userclicked.CFrame.Position.X, user.CFrame.Position.Y, userclicked.CFrame.Position.Z))
end)

That should fix your problem.

Also the function is called CFrame.lookAt, you can look more into it here

1 Like

This sort of works. There’s just weird shaking as well as that when the player clicks on a different player, they point towards the old one instead of the new one.

Doesn’t seem to be happening to me.

Did you make sure that you did this:
image

1 Like

Nevermind, I was using my cororoutines wrong. Thank you so much for the help.

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