I don’t think this would give the desired effect, since:
Gets uses the original X, Z rotation and only copies the Y rotation.
However, @Dev_OnCake, I think you might want to take a look at AlignOrientation (roblox.com). I haven’t experimented with it while AlignPosition.PrimaryAxisOnly == true, but it looks like that would allow you to copy only the Y rotation of the other part, without the need for a script. Don’t forget to set AlignPosition.Responsiveness = 200 if you want it to be an instant rotation, instead of a smooth one.
Thanks, but that’s not what I’m looking for.
Imagine the following: a character is moved by MoveTo(part) to this part. Now HumanoidRootPart should have exactly the same value on the Y-axis (look at the part!). CFrame.new(HRP.Position, Part.Position) is not suitable, because then the LookVector points upwards if the part is higher than the character. My code works so far, I just wonder if there is a better way to do this.
My first reply is the same as your current code, just written in a different way. It doesn’t really make anything switching to that approach, so I would probably just keep it as it is now.
Also, you can still use CFrames:
CFrame.new(HRP.Position, Part.Position * Vector3.new(1, 0, 1) + Vector3.yAxis * HRP.Position.Y)
-- Which is the same as:
CFrame.new(HRP.Position, Vector3.new(Part.Position.X, HRP.Position.Y, Part.Position.Z)
By setting the Y value to be the same as the current Y value we avoid the issue of it point upwards.