Hello. I am making a turret that points at the player’s mouse, and I tried to limit the rotation on the Y-axis but doesn’t seem to work properly. Here is a video:

And here is my code:

```
RunService.Heartbeat:Connect(function(dt)
local toAim = mouse.Hit.Position;
local CF = CFrame.lookAt(turret.Position, Vector3.new(toAim.X, turret.Position.Y, toAim.Z));
local X, Y, Z = CF:ToOrientation();
Y = math.clamp(Y, -2, 2)
turret.CFrame = CFrame.new(turret.Position)*CFrame.Angles(0, Y, 0)
end)
```

Thank you so much for reading! Any help is appreciated.