My part rotates when moving while using CFrame, I only want it to move

I am using CFrame to position a part of mine in my game. It should not repeat or anything, just move once. But I am experiencing an issue. The part’s orientation should be (0, 90, 0), but while the script is active, it changes to 0,0,0.
this is my script.

for i = 1,8 do
script.Parent.CFrame = +,0,.5))

i will provide a video if needed.

Because you are applying an entirely new CFrame, to modify it, you multiply it, and if you want only one thing to change from a new CFrame, get the old rotation.

When setting its CFrame, you are resetting its rotation.
You can simply just set its position without affecting its orientation with

script.Parent.Position = script.Parent.Position +,0,0.5)

This worked, thanks so much! I was having such an issue figuring this out.

1 Like

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