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

How to change HumanoidRootPart's Orientation without breaking the character?

Argument is mouse

Player.Character.HumanoidRootPart.CFrame=Player.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,Argument.Y,0)

I tried making a script where when you mouseclick your character turns to the Y position of your mouse. But I end up with a broken character. I really need your help pls

1 answer

✓ Accepted answer

You are trying to place a 2-Dimensional value (Mouse.X) inside a 3-Dimensional one (CFrame). Mouse.X is basically the x coordinate of the 2-Dimensional screen, and so using that would not work for a 3-Dimensional position like CFrame. That said, you would want the HumanoidRootPart's CFrame to be the X value of the mouse's Hit property, which is basically the CFrame value of where the mouse is pointing:

--Assume hrp is the HumanoidRootPart you are trying to use
hrp.CFrame=CFrame.new(hrp.Position)*CFrame.Angles(0,Argument.Hit.x,0)

Please accept answer if this helped :)

1 comment

0

Thanks for the explanation

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