Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

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!

0
Thanks xXxCONBOY456xXx 15 — 9y
0
You have a typo! `value` vs `v` in your loop snippet BlueTaslem 18071 — 9y
0
I made a typo in one of the scripts; fixed it now, sorry if you were confused. Perci1 4988 — 9y
0
Lol blue. I saw it just before you posted that. Perci1 4988 — 9y
Ad

Answer this question