This is my script, when the part gets removed, it clones it self back. But heres the issue tho, it clones its self multiple times. can someone maybe help?
local check_for2 = {
"AECMD",
}
game.Workspace.ChildRemoved:Connect(function(ChildRemoved)
local should_be2 = table.find(check_for2,"AECMD")
if should_be2 then
script.AECMD:Clone().Parent = game.Workspace
end
end)
end
You could use :Once instead of :Connect to only clone it once. Your if statement is odd, it should always evaluate to true, why do you find AECMD in the table above?
AECMD is the name of a part. I want to check if when a child is removed from workspace, that it isnt my part, and if it is, it would be cloned back to workspace. I play a lot of script building games.
Ok then you should be using this instead, and if you want to use the table as a long list of items to check for try the second part
-- 1st just one implementation
if ChildRemoved.Name == "AECMD" then
-- 2nd long list implementation
if table.find(check_for2, ChildRemoved.Name) then
script:FindFirstChild(ChildRemoved.Name):Clone().Parent = game.Workspace
end
local check_for2 = {
"AECMD",
}
game.Workspace.ChildRemoved:Connect(function(ChildRemoved)
if table.find(check_for2, ChildRemoved.Name) then
script:FindFirstChild(ChildRemoved.Name):Clone().Parent = game.Workspace
end
end)
end