This 1 line is my problem. This is supposed to put the "Part" in front of the HumanoidRootPart and change the Rotation to the HumanoidRootPart's Rotation. It changes the position correctly, but the rotation isn't correct. Help plz ;). Part is an instance that I didn't include in this code.
Part.CFrame = (script.Parent.HumanoidRootPart.CFrame + script.Parent.HumanoidRootPart.CFrame.lookVector * 2) * CFrame.Angles(math.rad(script.Parent.HumanoidRootPart.Rotation.X),math.rad(script.Parent.HumanoidRootPart.Rotation.Y),math.rad(script.Parent.HumanoidRootPart.Rotation.Z))
You're actually already setting the rotation of the part when you change it's CFrame to the HumanoidRootPart's CFrame.
Part.CFrame = script.Parent.HumanoidRootPart.CFrame + script.Parent.HumanoidRootPart.CFrame.lookVector * 2
You could also do this like the following:
Part.CFrame = script.Parent.HumanoidRootPart.CFrame * CFrame.new(0, 0, -2)
If this helped, please mark it as the correct answer, thanks!