Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

So after this, my sword only spawns 3 times now. I want it to spawn infinitely. What's going on?

Asked by 2 months ago
bin = script.Parent

ItemName = "Darkheart" 
WaitTime = 5 


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)

1 answer

Log in to vote
0
Answered by 2 months ago

There is a easier way to do this

game.Players.PlayerAdded:Connect(function(player)
        player.CharacterAdded:Connect(function(char)
-- do the clone script 
    end
end)
Ad

Answer this question