Workspace.MountedM2Browning.ControlScript:11: attempt to index nil with 'Move' - Error with mouse

So I am trying to make a mounted machinegun follow the players mouse, but the players mouse always returns nil for some reason. I don’t know why. Here is my script;

local Part = script.Parent.PivitPart
local IsControlling = false

script.Parent.ControlButton.ProximityPrompt.Triggered:Connect(function(Player)
	print(Player)
	if IsControlling ~= true then
		IsControlling = true
		
		local Mouse = Player:GetMouse()
		print(Mouse)
		
		Mouse.Move:Connect(function()
			Part.CFrame = CFrame.lookAt(Part.CFrame, Mouse.Hit.Position)
		end)
	else
		IsControlling = false
	end
end)

The script is a server script inside of the modal.

You cannot get the player’s mouse in a server script, you would have to use a local script.

Just like @verbxtim said, you can’t access a players mouse from a server script, you would need to use a remote event (that gets handled by a local script) to do things with the mouse. FireClient on that remote event to call the remote (inside the server script)