How to make a turret point towards the players mouse?

Im currently rewiting my turret and im tried it with the scripts i found on the forum but they dont work, the turret behaves really weird. In this video you can see that it doesnt work.
The current scripts ive been using

Client:

local function doHorizontalMathForRotate(MousePos,Base)
	local baseToTargetVector = Base.Position - MousePos
	local xAngle = math.deg(math.atan2(baseToTargetVector.Z,baseToTargetVector.X))-90  + Base.Orientation.Y
	return xAngle
end

RunService.Heartbeat:Connect(function()
	if InTank == true then
		local mousePoint = Mouse.Hit.Position
		local targetVector = (mousePoint - Mouse.Origin.Position).unit
		local xAngle = doHorizontalMathForRotate(Mouse.Hit.Position,TankObj.Value.Turret.PrimaryPart)
		TurretMovement:FireServer(TankObj.Value,xAngle)
	end
end)

Server:

game.ReplicatedStorage.TurretMovement.OnServerEvent:Connect(function(plr,Tank,TurretMovement)
	if Tank == script.Parent.Tank then
		if TurretMovement then
			Turret.TurretRootPart.HingeConstraint.TargetAngle = math.deg(TurretMovement)
		end
	end
end)

Correct me if I’m wrong, but why are you double-converting the movement into degrees? (One on client, one on server)

i overlooked that, i removed one of them but that didnt fix the issue. It made it somewhat better but it still didnt fix it

do you have an idea on how to fix the problem im having?