Changing Turret Angles

I’m trying to make a simple turret sent where your seat/turret turn with you. Here’s what I have so far:

local pl = self.Seat:GetDriver()
if ValidEntity( pl ) then

	local ang = pl:GetAimVector():Angle()
	local seatyaw = self.Seat:GetAngles().yaw 

	if math.abs( seatyaw - (ang.yaw - 100) ) > 30 then 
		local n = Lerp(0.05,seatyaw,ang.yaw-100)
		self.Seat:SetAngles( Angle( 0,n, 0 ) )


Basically, when you look left/right it turns left/right. However, for values of “n” around -30 and 200, the thing starts to spazz. Like, if I keep looking in that direction, it tries to turn but keeps resetting to 20ish degrees before. Any clue on how I can fix this?

Why are you subtracting 100 from ang.yaw?

Because for some reason, when I compared the seat’s angles to my view angles, my view angles were always 100 greater. Dunno why, but subtracting 100 made it much more nice.

You should try using these: