Help with rotating tank turret

I am trying to make a rotating tank turret using a motor6d constraint to rotate it. But it doesn’t seem to be working, and when I run it if I change the values they instantly go back

Script:
local plr = game.Players.LocalPlayer
local char = plr.Character
local turret = char:WaitForChild(“Turret”)
local camera = game.Workspace.CurrentCamera
local root = char:WaitForChild(“HumanoidRootPart”)
local hinge = char:WaitForChild(“Hinge”)

local Mouse = plr:GetMouse()
local RunService = game:GetService(“RunService”)

RunService.RenderStepped:Connect(function()
hinge.C0 = CFrame.Angles(0, Mouse.Hit.Y, 0)

local RootPos, MousePos = turret.Position, Mouse.Hit.Position
local camerapos = root.Position + Vector3.new(0, 20, 10)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.lookAt(camerapos, root.Position)

end)

video: