im making my first gun so my code isnt the best, but how can i prevent the gun from shooting after the player unequipped it?
Client Side Code
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Parent.Equipped:Connect(function(eqp)
print("eqp")
mouse.Button1Down:Connect(function(input)
script.Parent.Parent.fire:FireServer(mouse.hit.p)
end)
end)
Server Side Code
local RS = game:GetService("ReplicatedStorage")
local beam = RS.beam
local tip = script.Parent
script.Parent.Parent.fire.OnServerEvent:Connect(function(player, mousePos)
print("hello")
local beamClone = beam:Clone()
beamClone.Parent = game.Workspace
beamClone.Position = mousePos
beamClone.CanCollide = false
beamClone.Size = Vector3.new(.3,.3,.3)
beamClone.BrickColor = BrickColor.new("New Yeller")
beamClone.Material = "Neon"
wait()
beamClone:Destroy()
end)
--end)
I dont have any errors it works as id like it to but when i put the tool away it still fires the bullets when i click ANY advice would be helpful even if it doesn't have to do with the question, thanks!!

1 comment
tool.Unequipped, tool.Unactivated, tool.Activated, etc etc. there's your answer <3