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

My Anti-Exploit script Isn't Deleting Workspace's children, Can someone please Help Me?

I was making this anti-exploit script and it's supposed to delete all of Workspaces's children. Why doesnt it work? This is the script

--[[{{{(((^<<<THIS SCRIPT CHECKS IF THE BRICK CLEANUP SCRIPT WORKS, IF YOU HEAR A LOUD SIREN, SOMEONE HAS EXPLOITED
 IF YOU DO NOT WANT THIS SCRIPT IN THIS TOOL, PLEASE DISABLE IT >>>^)))}}]]--

local h = Instance.new ("Hint")
h.Parent = game.Workspace
h.Text = "ANTI-EXPLOIT/ANTI-SPAM v0.8 BY xXxCONBOY456xXx"


local EXPLOIT = script.Sound

if script.Parent.Parent ~= nil then

wait(26)

if script.Parent.Parent ~= nil then
	EXPLOIT:play()
	
wait(100)

if script.Parent.Parent ~= nil then
	
	script.Parent.Parent.Parent.GetChildren:Destroy()
	
elseif script.Parent.Parent ==nil then
	
	return
	
end	
	
end
end

1 answer

✓ Accepted answer

You're using GetChildren() wrong. GetChildren() is a method, which means to use it you must use :. On top of that, it returns a table. You can only use the Destroy() method on an Instance. To destroy all of workspace's children with GetChildren(), we must use a for loop.

for index,value in pairs(Workspace:GetChildren()) do
	value:Destroy()
end

This should work, but it would be much cleaner to use ClearAllChildren().

Workspace:ClearAllChildren()

Hope I helped!

4 comments

0

Thanks

0

You have a typo! value vs v in your loop snippet

0

I made a typo in one of the scripts; fixed it now, sorry if you were confused.

0

Lol blue. I saw it just before you posted that.

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