Attempt to index nil 'Mousebutton1Down'

I am trying to make an artillery system, and I keep getting "attempt to index nil ‘Mousebutton1Down’ even when the mouse is referenced


seat.Changed:Connect(function()
	wait(0.5)
	local Plr = Players:GetPlayerFromCharacter(seat.Occupant.Parent)
	local PlayerChar = Plr.Character
	
	Plr:GetMouse().Button1Down:Connect(function()
		FireTheGun(Plr:GetMouse().Target.Position)
	end)
	
end)

MouseButton1Down is for buttons

Hello again! Is this on a server script? Because you can’t call :GetMouse() on a server script. Just make a local script fire a remote event when the player clicks.

You’re trying to get player’s mouse from a server script which is not possible. You will either have to use remote events or put a physical button with a click detector.

I see, I was trying to do it from a serverscript, as i thought it would work since i had the player

Attach a local script to the server script and clone it to the player’s playerScripts.