How can I make the gun barrels point up and down to my mouse position?

I am aiming to make a turret pointing system and I am currently working on a simpler version of it to start off. I want the turret barrels to point or down based on my mouse location. The barrel is grouped and I am using a hinge to connect the turret head with an invisible part that is welded to the barrel.

The current issue is that the barrel isn’t functioning as expected.
https://gyazo.com/ed502ed74528d46545f388cf17512fb3
My code:
Local

local replicatedStorage = game:GetService("ReplicatedStorage")
local barrelEvent = replicatedStorage:WaitForChild("UpDown")
local rotating = game.Workspace.BarrelEpic.ROTATING
local bodygyro = rotating.BodyGyro
local mouse = game.Players.LocalPlayer:GetMouse()

while wait(0.05) do
	barrelEvent:FireServer(mouse.Hit.Position)
end

Server

local replicatedStorage = game:GetService("ReplicatedStorage")
local barrelEvent = replicatedStorage:WaitForChild("UpDown")
local rotating = game.Workspace.BarrelEpic.ROTATING
local bodygyro = rotating.BodyGyro

barrelEvent.OnServerEvent:Connect(function(player, mouse)
	bodygyro.CFrame = CFrame.new(bodygyro.Parent.Position, Vector3.new(rotating.Position.X, mouse.Y, rotating.Position.Z))
end)

I suspect that it has something to do with the bodyGyro but I can’t figure it out myself.
Any help is appreciated and I can provide more info if needed!!

1 Like

Anyone pls help meeeeee I am stuck