Hi! For the past few hours I’ve been stuck with trying to find a way to rotate an object max 90 degrees left & right. using CFrames, (I’m trying to make a security camera that can rotate) I have completely no idea how to do this. Any help is appreciated

1 Like

Convert CFrame to angles, clamp the angles, then turn the angles into CFrame again.

2 Likes

Hey, thanks for replying so fast! I just don’t understand how to do this when you’re turning it, could you explain it more understandable for me? I am not very advanced at scripting.

1 Like

You can set variables for each rotation axis, and clamp those values.

I’ve done this for my custom camera system, my free camera system, and it seemed to work fine.

Usage example:

```
local xAxis = math.clamp(..., -45, 45)
cframe * CFrame.Angles(xAxis, 0, 0)
```

1 Like