Part infinitely cloning

So, I have a script that checks if a certain part is in workspace after it detects childremoved from workspace. when the part gets deleted it clones it self a bunch of times
script below

local check_for2 = {
	"AECMD",

}
while wait() do
	game.Workspace.ChildRemoved:Connect(function(ChildRemoved)
		wait()
		local should_be2 = table.find(check_for2,"AECMD")

		if should_be2 then

			script.AECMD:Clone().Parent = game.Workspace
		end
	end)
end

image

Try adding a Boolean? Maybe it’s gonna work

I honestly forgot what a boolean is.

A Boolean is either true/false/nil

Is the script in the part that you’re cloning?

The while loop is what’s causing it to clone a bunch of times since you’re making a bunch of ChildRemoved events. Not sure what you want the end result to be.

1 Like

No, the part being cloned to workspace is a descendent of the script.

Just want it to clone once each time its removed from workspace. instead its cloning 32 times,

I removed while wait. it works now.

wait so what are you trying to do? are you trying to clone it when it gets removed?

You should also check to make sure the child that was removed was the part you want cloned.

local should_be2 = table.find(check_for2, ChildRemoved.Name)

A Boolean is JUST true or false

nil means “No Value”, and does not stand for anything.

Sorry, my fault, I’m sleepy right now :rofl::rofl::rofl: but yeah, you’re right