You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I am using CFrames on a Weld and I want to limit the angle of the Weld, so I am using Math.Clamp but it only works on one side of rotation. How would I fix this?
- What is the issue? Include screenshots / videos if possible!
Before Rotation
After
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I havent found anything that would fix this, thank you for any help!
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- T1 is the Turret Model, MP is the MainPart, Target is the part its looking at
local cf = CFrame.lookAt(T1.MP.Position, Vector3.new(workspace.Target.Position.X,T1.MP.Position.Y,workspace.Target.Position.Z))
local X,Y,Z = cf:ToOrientation()
local newYAngle = math.clamp(Y, math.rad(-35), math.rad(95))
T1.MP.Weld.C0 = T1.MP.CFrame:ToObjectSpace(CFrame.new(cf.Position) * CFrame.fromOrientation(X,newYAngle,Z))