Help with changing a system that detects when the mouse is down to mouse clicks if the gun has a certain name

Hi!

I currently have a system for my gun that detects when the mouse button is down for full-auto fire, and I’m not really sure how I would change it to detect single mouse clicks, preferably it would be an if-else statement to detect if its in the pistols or rifles
Here is my code

inputs.BindOnEnded("MouseButton1", nil, function() weapon:fire(true) end, "PewPew")
inputs.BindOnEnded("MouseButton1", nil, function() weapon:fire(false) end, "PewPewEnd")