I am working on a Sword Regen Script, and for some reasons that I don't know, It can only respawn 1 time after taken by a player.
The Outrageous Sword Item Name is correct, but like I said, it can only respawn 1 time.
Here's the script:
bin = script.Parent
ItemName = "Outragousword" -- The name of the item in the stand.
WaitTime = 20 -- The amount of time to wait before regenerating the item.
Item = bin:findFirstChild(ItemName)
backup = Item:clone()
function regen()
local regen = backup:clone()
regen.Parent = bin
end
debounce = false
function onTaken(property)
if (debounce == true) then return end
debounce = true
if (bin:findFirstChild(ItemName) == nil) then
wait(WaitTime)
regen()
end
debounce = false
end
Item.Changed:connect(onTaken)
What am I suppose to add to make the Sword Respawn every time it's been taken by players instead of just once?
