I'm trying to make a script to delete a bunch of other scripts inside parts called "AntiUnlock" Here is my script I put into command bar, it just turns black.
local anti = workspace:FindFirstAncestor("AntiUnlock") if anti then anti:Destroy() end
For more information here it is: I've tried using :FindFirstChild and it does the same thing. When I execute it into command bar the whole thing doesn't run, it just turns black. I've tried :FindFirstDescendant(), unfortunately that isn't a real thing.
You are using :FindFirstAncestor()
You should use :FindFirstDescendant()
, since, like @UgOsMiLy commented, Workspace has no ancestor except for game. The correct script should be
local anti = workspace:FindFirstDescendant("AntiUnlock") if anti then anti:Destroy() end
If this doesn't work, try :FindFirstChild()
If something's wrong, Leave a comment :)
local anti = workspace:GetChildren() for i=1 , #anti do if anti[i] == "AntiUnlock" then --Try if anti[i].Name == "AntiUnlock" then anti[i]:Destroy() end end