Cannon Rotation Help

I’m trying to create a cannon that you can rotate sideways by using A and D, and vertical by W and S. However, I’m not sure how I can get it to rotate vertically as my current setup is built so that my chair turns and I just welded the model to the chair. How can I make it so that I’m able to turn the cannon vertically?

local bv = script.Parent.BodyVelocity

local bav = script.Parent.BodyAngularVelocity

local seat = script.Parent

local speed = 0
local maxSpeed = 0
local rotSpeed = 0
local maxRotSpeed = 1.5

delay(0, function()
	while true do
		bv.velocity = seat.CFrame.lookVector * speed
		bav.angularvelocity = Vector3.new(0, rotSpeed, 0)
		wait()
	end
end)

seat.Changed:connect(function(prop)
	if prop == "Throttle" then
		if seat.Throttle == 1 or seat.Throttle == -1 then

			speed = maxSpeed * seat.Throttle

		elseif seat.Throttle == 0 then

			speed = 0

		end
	elseif prop == "Steer" then
		if seat.Steer == -1 or seat.Steer == 1 then

			rotSpeed = maxRotSpeed * -seat.Steer

		elseif seat.Steer == 0 then

			rotSpeed = 0

		end
	end
end)

Model Link: Cannnon - Creator Store

For rotating up, I’d just use an angular velocity constraint perpendicular to bav and run it the same way you’ve been running bav. If you still want to use a body angular velocity constraint, I suppose it will work too.

If that’s a bit confusing, I’d be willing to take a look at your model if you made it publicly accessible and point out how it might be done.

Use a HingeConstraint set as Motor for your rotation and change the AngularVelocity to spin the turret.
Use a HingeConstraint for vertical set to Servo then set your TargetAngle using Throttle in the script.

It’s so much easier than using AnguarVelocity. It’ll move at a certain speed no matter what and you can control it much more easily.
For an example look at the anti-aircraft gun in my B25 bomber place, or the crossbow turrets in my Steampunk place. They’re on the blimp above the center island…