So I use this script to make my weapons respawn
local gear = {} for i,v in pairs (workspace:GetChildren()) do if v:IsA("Tool") then gear[i] = v:clone() v.AncestryChanged:connect(function() Delay(30, function() -- 30 = time until respawn gear[i]:clone().Parent = workspace end) end) end end
However, how do I make it so that once the tool has been taken, after a certain amount of time, it will spawn another one, BUT, only one, until it gets taken again, and then the timer starts again.
T=true local gear = {} for i,v in pairs (workspace:GetChildren()) do if v:IsA("Tool") and T==true then T=false gear[i] = v:clone() v.AncestryChanged:connect(function() Delay(30, function() -- 30 = time until respawn gear[i]:clone().Parent = workspace end) T=false end) end end
Try this...not sure if it'll work, but give it a shot. If this doesn't work then just try debouncing it at different areas in the script.