This is kind of complicated, but let me try to explain.
CFrame usually looks like this: CFrame.new(Position, Orientation). But, it's kinda stupid. The second part, orientation, is also a position, meaning the part will face towards whatever position you put into the Orientation. For example, if I made a script saying Block.CFrame = CFrame.new(Block.Position, Ball.Position), the Block will face towards the ball. Pretty simple, right?
So, here's the issue: Your script leaves the second part of the CFrame empty, which means that by default, it resets the orientation. There are three ways to fix it, the last being the most efficient:
- Set the Orientation Back every time you change the CFrame
- Find the position in front of where your block was facing, and set that as the second part of the CFrame.
- Use
Position Instead of CFrame.
Like I said, it's pretty stupid, but it's useful if you want to make something like an NPC that faces towards your character, or a gun that fires where your mouse is aimed. It's best that you just use Position Instead of CFrame when making your type of script. Changing the position doesn't change the orientation, unlike CFrame.
5 comments
This is helpful. I think my drag tool, unlike other drag tools resets the orientation because it uses CFrame changes instead of position changes. This is a very interesting question/answer.
Thanks. I edited my answer like 5 times just a moment ago, so you might want to reread even though I didn't change much in it.
Ok i will try it
Great now it goes on top of something
^Its now working btw