Need help on adding limit to turret

local Platform = script.Parent.Movement
local Rotor = script.Parent.Rotor
local seat = script.Parent.VehicleSeat

seat.ChildAdded:connect(function(object) -- Seat Client Add
if object:IsA("Weld") and object.Name == "SeatWeld" then
	local player = game.Players:GetPlayerFromCharacter(object.Part1.Parent)
	local clientScript = script.Client:clone()
	clientScript.Parent = player.PlayerGui
		
		seat.ChildRemoved:connect(function(object) -- Seat Client Remove
	    clientScript:Destroy()
	    end)	
    end
end)

game:GetService("RunService").Stepped:connect(function()
	if seat.Throttle == 1 then -- Down
		Rotor.Weld.C0 = Rotor.Weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(-0.6),0,0)
			
    elseif seat.Throttle == -1 then -- Up
		Rotor.Weld.C0 = Rotor.Weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(0.6),0,0)
	end
	
	if seat.Steer == 1 then -- Right
		Platform.Weld.C0 = Platform.Weld.C0 * CFrame.fromEulerAnglesXYZ(0,math.rad(-0.6),0)
		
	elseif seat.Steer == -1 then -- Left
		Platform.Weld.C0 = Platform.Weld.C0 * CFrame.fromEulerAnglesXYZ(0,math.rad(0.6), 0)
	end
end)

i need help adding limits on up and down rotation.
i dont know how to do it

You can use this,

math.clamp(value, min, max)

how can i apply it? i looked up for it and i dont knowhow

Easier solution would be to add an if statement that checks if the current orientation is less than the max before rotating the turret. I’m gonna give you an example,

	if seat.Throttle == 1 and Rotor.Weld.C0.Orientation.X < 45 --[[angle]] then -- Down
		Rotor.Weld.C0 = Rotor.Weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(-0.6),0,0)