im currently working on a gun and im having this weird glitch and getting literally and headache because of it.
So if you equip the tool more than once like 5 times and click it will print "ok" 5 times, idk why i am getting this...
here is the script:
tool = script.Parent
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
Fire = false
equip = false
tool.Equipped:connect(function()
equip = true
mouse.Button1Down:connect(function(mouse)
Fire = true
if equip and Fire == true then
print("ok")
end
end)
end)
tool.Unequipped:connect(function(mouse)
equip = false
Fire = false
end)
help?

4 comments
Because you're connecting to mouse.Button1Down on each equip and never bothering to Disconnect, you need to Disconnect the event on Unequipped (or better yet, just use tool.Activated)
Its disconnecting on Unequipped, and i tried it out with Activated.. its still the same.
No, mouse.Button1Down:Connect() gets connected every single time equipped is fired. You are not disconnecting the mouse.Button1Down event, you're only running a debounce
And as for activated, don't put activated inside of the tool.Equipped:Connect() (which is the exact same problem as mentioned above). You can delete everything after line 04, then do tool.Activated:Connect()