I want to set something’s CFrame to be exactly like another thing’s except I don’t want it to be rotated on the X axis at all. I want to keep the position on the X axis, but not the rotation. How would I do this?
This is what I’m doing right now, but it moves the part above where it should be:
This is one of the times the evil Safe Move rears its ugly head. It’s a really awful and unintuitive behavior that causes parts to shift up whenever certain properties are set (e.g. Position, Orientation, Shape, etc). There were plans to remove it, but it seems like it’s being held up by legacy games:
and since there’s a big game (Bloxburg) that uses safe move, that’s probably preventing it from being nuked.
For now you’ll need to use purely CFrame to avoid safe move. You can change your code to:
local orientation = CFrame.Angles(0, cl.Part.Orientation.Y, cl.Part.Orientation.Z)
cl:SetPrimaryPartCFrame(CFrame.new(target.CFrame.p) * orientation)