Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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))
0
actually the code is inside of the remote event cherrythetree 130 — 5y
0
actually the code is inside of the remote event cherrythetree 130 — 5y
0
actually the code is inside of the remote event cherrythetree 130 — 5y
0
what is the full script TheWiseAndGreat 50 — 5y
Ad

Answer this question