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

CleanUp script Perma-Deletes PlayerModel! Help!?!?

You've probably seen this question before, The "Terrain" and "Camera" in Workspace is still annoying me :/

I am trying to make a CleanUp script for glitched out debris in the workspace, but there are so many parts to be named, I decided to go with a script that deletes everything outside a folder Called "World"

local Time = 5 -- The time you want it to disappear (Short time for testing purposes)

while true do
	for i, v in pairs(workspace:GetChildren()) do -- Getting all the children in workspace
		if v.Parent ~= workspace.World and v.Name ~= "Terrain" and v.ClassName ~= "Camera" and v.Name ~= "World" then
			v:Destroy() 
		end
	end
	wait(Time) -- Wait to stop the loop from breaking the game.
end

Attempts: -Tried to Make a StarterCharacter script which parents you to the folder, Output says no

1 answer

✓ Accepted answer

Im not really sure what you were asking, but i adapted it to not destroy Characters. If this isnt what you asked could you ellaborate on what you wanted and why it didnt work

local Time = 5 -- The time you want it to disappear (Short time for testing purposes)

while true do
    for i, v in pairs(workspace:GetChildren()) do -- Getting all the children in workspace
        if v.Name ~= "Terrain" and v.ClassName ~= "Camera" and v.Name ~= "World" and not v:FindFirstChild("Humanoid") then -- dont destroy: Terrain, Camera, World and instances who contain Humanoids (npcs and Characters)
            v:Destroy() 
        end
    end
    wait(Time) -- Wait to stop the loop from breaking the game.
end

1 comment

0

Yes, Thank you very much!

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