i have been having issues in my game with people spamming huge gears lagging and sometimes even crashing servers wich is pretty annoying. I was wondering, is it possible to make a cooldown on equipping the tools you have in your inventory?
You can use the Equipped() and Unequipped() events to detect when a tool is equipped or unequipped. You can then use a debounce that expires after a couple of seconds to keep people from repeatedly unequipping and equipping a tool. It would look something like this:
local equippable = true
local equipCooldown = 5
tool.Equipped:Connect(function()
if(not equippable) then
tool.Parent = player.Backpack --Puts the tool back in the player's backpack
end
end)
tool.Unequipped:Connect(function()
if(equippable) then
equippable = false
wait(equipCooldown)
equippable = true
end
end)