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

Making the player face at the mouse randomly teleport the player in the mouse! How can I fix this?

I am experiencing a bug that when the player used to face something with CFrame, it sometimes annoyingly teleport the player into the mouse or sometimes it would face the mouse.

player.Character.PrimaryPart.CFrame = CFrame.new(player.Character.PrimaryPart.CFrame.Position, Vector3.new(mouse.p.X, player.Character.PrimaryPart.CFrame.Position.Y, mouse.p.Z))

(Did not add the identifiers, this is just a piece of code that I put) It abnormally teleports the player in the mouse. Is there anything you notice in the script? The PrimaryPart was the head. The same goes for when I use HumanoidRootPart.

1 answer

Im not sure how you got that one line to work without getting an error because mouse.p is not a thing mouse.Hit.p is. you can try my code

player.Character.PrimaryPart.CFrame = CFrame.new(player.Character.PrimaryPart.CFrame.Position, Vector3.new(mouse.Hit.p.X, player.Character.PrimaryPart.CFrame.Position.Y, mouse.Hit.p.Z))

4 comments

0

actually the code is inside of the remote event

0

actually the code is inside of the remote event

0

actually the code is inside of the remote event

0

what is the full script

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