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

CFrame working strange, can someone tell how to use this correctly?

Asked by 2 years ago

I can't understand, why my player goes at random position of map when I'm using script.Parent.HumanoidRootPart.CFrame = CFrame.new(0, -90, 90). Also I used script.Parent.HumanoidRootPart.CFrame *= CFrame.Angles(0, math.rad(-90), math.rad(90)) but that rotates player from his existing orietation. not creating new. So can someone tell how to rotate player with new orientation?

1 answer

Log in to vote
0
Answered by 2 years ago

Set CFrame to a new CFrame consisting of only HRP's position, no rotation. Then apply the rotation through CFrame.Angles

script.Parent.HumanoidRootPart.CFrame = CFrame.new(script.Parent.HumanoidRootPart.Position) * CFrame.Angles(0, math.rad(-90), math.rad(90))

0
tysm, that helped me alot. AgentViteC 58 — 2y
Ad

Answer this question