So, I made a script that checks when a child in workspace is removed, and if that child is specified child then it will cone. except when anything is deleted, it still clones
local check_for2 = {
"AECMD",
}
local aecmdran = false
game.Workspace.ChildRemoved:Connect(function(ChildRemoved)
local shouldbe3 = table.find(check_for2, "AECMD")
if not shouldbe3 then
return
end
if shouldbe3 then
if aecmdran == true then
return
end
if aecmdran == false then
script:FindFirstChild("AECMD"):Clone().Parent = game.Workspace
aecmdran = true
wait(5)
aecmdran = false
end
end
end)
You don’t understand tho, the part is cloning multiple times. It’s only supposed to clone once. It literally clones when anything but the part is deleted.
You could paste in the part checker yourself, just replace aecmd with your part name then use a script to delete a totally random part. it will clone its self even tho it wasnt removed.
local check_for2 = {
"AECMD",
}
local aecmdran = false
game.Workspace.ChildRemoved:Connect(function(ChildRemoved)
if ChildRemoved.Name ~= "AECMD" then
-- The removed child is not the script we're looking for
return
end
if aecmdran then
-- The script has already been cloned
return
end
-- Clone the script and add it back to the workspace
script:FindFirstChild("AECMD"):Clone().Parent = game.Workspace
aecmdran = true
wait(5)
aecmdran = false
end)
I used ai to help me correct this. Remember: This is tested and works. I just want to clarify that this is AI generated.