-- Bind function to fire event

fireEvent.OnServerEvent:connect(function(player, target)
	if tool.Parent == player.Character then
		-- If tool has enough shots then fires. Otherwise reloads.
		if currentAmmo <= 0 then
			return reload()
		end
		if canFire then
			canFire = false
			currentAmmo = currentAmmo - 1
			fireSound:Play()
			createBullet(target)
			delay(attackCooldown, function()
				canFire = true
			end)
		end
	end
end)

