im using hinges to rotate a turret towards a mouse. i gotten so close to doing it but it is off when turning around
script:
local goal = CFrame.lookAt(
rotateOrigin.Position,
mouse.Hit.Position
)
local y, x ,z = goal:ToOrientation()
print(x, y, z)
rotateHinge.TargetAngle = x * 360
i also tried:
rotateHinge.TargetAngle = math.deg((mouse.Origin.Position - mouse.Hit.Position).Unit.X)
this is done on a local script