Turning Character whilst in a Vehicle

He llo. I am attempting to create a gun system. I have an idea down, where I’d use the RootJoint of a HumanoidRootPart in order to point the character to where their mouse is pointing, whilst in a vehicle.

However, since I don’t have much knowledge on C0 and making things move with your mouse, it’s proven somewhat difficult for myself. The reason why I want to do this is so I could make it seem more realistic/immersive, with the player actually pointing their firearm in the direction of where they want to fire.

My gun system is based off having 2 directions: a barrel direction, and a mouse direction. At first it’ll see if the mouse is close to where the barrel is pointing. If it is, it’ll use the mouse, if it isn’t, it will use the barrel instead. Meaning that you can’t go into third person and start unloading into someone thats behind you, making it more immersive/competitive, and not just being another RCL gun system.

if Character.Humanoid.SeatPart then
	print("Found part")
	local seatX, seatY, seatZ = Character:FindFirstChild("HumanoidRootPart").RootJoint.C0:ToEulerAnglesYXZ()
	local SeatPosition = (Character:FindFirstChild("HumanoidRootPart").RootJoint.C0 * CFrame.Angles(0, 0, -seatZ)) * CFrame.Angles(0, 0, math.asin((Mouse.hit.p - Mouse.Origin.p).unit.y))
	Character:FindFirstChild("HumanoidRootPart").RootJoint.C0 = Character:FindFirstChild("HumanoidRootPart").RootJoint.C0:Lerp(SeatPosition, .3)

The code above is what im using in the video. I basically took what I did with the arms and put it for the humanoidrootpart instead. It appears that when you move the mouse it won’t stop unless counteracted by moving the mouse in the other direction. I’m wondering how to fix this so that It’ll always point where your mouse is, as well as some sort of way to limit the torso moving a full 180, and instead only a 90 in both directions. Again, I’m not good at this stuff, so I need some sort of help on this.