of     1   

Kevinllululala
#228322989Saturday, December 02, 2017 11:07 AM GMT

How do I make a script that deletes everything in the workspace, serverstorage, serverscriptstorage, replicatedstorage, and startergui
Camper0008
#228323065Saturday, December 02, 2017 11:13 AM GMT

why ╴ “I seem to get mentioned alot in videogames.. i wonder why..”
Divitiae
#228323101Saturday, December 02, 2017 11:15 AM GMT

workspace = game.Workspace:GetChildren() for i,v in pairs(workspace) do v:Destroy() end
Kiriot22
#228323107Saturday, December 02, 2017 11:16 AM GMT

for i,v in pairs(workspace:GetChildren()) do pcall(game.Destroy, v) end
amanda
#228323108Saturday, December 02, 2017 11:16 AM GMT

clearallchildren
Camper0008
#228323110Saturday, December 02, 2017 11:16 AM GMT

you cant destroy terrain so i believe that would error my guy ╴ “I seem to get mentioned alot in videogames.. i wonder why..”
Divitiae
#228323143Saturday, December 02, 2017 11:19 AM GMT

asgw = game.Workspace:GetChildren() for i,v in pairs(asgw) do if v.Name ~= "Terrain" and v.Name ~= "Camera" then v:Destroy() end end
Divitiae
#228323163Saturday, December 02, 2017 11:21 AM GMT

^ this will work, i tested it
Kiriot22
#228323170Saturday, December 02, 2017 11:22 AM GMT

function Clear(services) for _,v in pairs(services) do local service = game:GetService(v) for _,v in pairs(service:GetChildren()) do pcall(game.Destroy, v) end end end Clear({"Workspace", "ServerStorage", "ServerScriptService", "ReplicatedStorage", "StarterGui"}) Although clearing ReplicatedStorage is a bad idea, since chat remotes are stored there.
IcedVapour
#228323647Saturday, December 02, 2017 12:00 PM GMT

oml no need for loops just use workspace:ClearAllChildren() serverstorage:ClearAllChildren() etc
GodShowsTheWay
#228324837Saturday, December 02, 2017 1:13 PM GMT

using ClearAllChildren on workspace will error because it will try to destroy terrain
Divitiae
#228327163Saturday, December 02, 2017 2:41 PM GMT

^
Luckyxero
#228327740Saturday, December 02, 2017 2:58 PM GMT

for i, v in pairs(workspace:GetChildren()) do if v.Name ~= "Terrain" then v:Remove() end end
Kiriot22
#228327788Saturday, December 02, 2017 3:00 PM GMT

Remove() is deprecated
DarkLight
#228327979Saturday, December 02, 2017 3:05 PM GMT

local DestroyAllChildren = function(...) for i, v in pairs(unpack(...)) do pcall(game.Destroy, v) end end DestroyAllChildren(workspace, game:service'ServerStorage', game:service'ReplicatedStorage', game:service'StarterGui')
Luckyxero
#228328087Saturday, December 02, 2017 3:08 PM GMT

wow he joined in 2006
Kiriot22
#228328150Saturday, December 02, 2017 3:10 PM GMT

You can't use unpack() on ... as it's already "unpacked"

    of     1