Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.