Hello! I am trying to make a tool delay, to prevent lag from spammers. I've been working on this for almost 2 weeks, and I'm having no luck. If you know how to make a delay, please help me out! I'm losing my mind still working on this! Thanks for any help!
Here's the script I've been working on:
local tool = script.Parent toolfolder = game.ServerStorage:WaitForChild("Toolfolder") tool.Unequipped:Connect(function() tool.Parent = toolfolder wait(1) tool.Parent = game.Players.LocalPlayer.Backpack end)
There's no one way to make a delay. Personally, if I were you I'd make the delay when the player equips the tool using a debounce. Like so:
local debounce = false tool.Equipped:Connect(function() debounce = true wait(2) debounce = false end) tool.Activate:Connect(function() if debounce == true then return end debounce = true -- tool code wait(2) debounce = false end
I'm not giving you code here, I'm giving you an idea which hopefully you can implement into your tool.