!!! WHAT TO DESTROY!!!
1. Dynamic Instances
What: Part, ScreenGui, Sound, etc.
How:
local part = Instance.new("Part")
part.Parent = workspace
part:Destroy()
2. Event Connections
What: .Touched, .Changed, .MouseClick, etc.
How:
local conn = part.Touched:Connect(function()
print("Touched")
end)
conn:Disconnect()
3. Coroutines / Loops / Tasks
What: task.spawn, while, loops
How:
local running = true
task.spawn(function()
while running do
task.wait(1)
end
end)
running = false
4. Cloned Models / Tools
What: Cloned parts, NPCs, tools
How:
local clone = template:Clone()
clone.Parent = workspace
clone:Destroy()
5. Temporary Effects or Sounds
What: Explosion, Sound, ParticleEmitter
How:
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://123"
sound.Parent = workspace
sound:Play()
sound.Ended:Connect(function()
sound:Destroy()
end)
6. Temporary UI
What: Notifications, prompts, dialog boxes
How:
local gui = Instance.new("ScreenGui")
gui.Parent = player:WaitForChild("PlayerGui")
gui:Destroy()
7. Temporary Values
What: BoolValue, IntValue, etc.
How:
local flag = Instance.new("BoolValue")
flag.Value = true
flag:Destroy()
!!! WHAT YOU SHOULD NOT DESTROY !!!
| Type |
Example |
Why |
| Services |
game:GetService("Players") |
Core system services; destroying will break game |
| Static Assets |
Assets in ReplicatedStorage, ServerStorage, StarterGui, etc. |
Shared across sessions, used for cloning |
| Starter Scripts |
Scripts inside StarterGui, StarterPack, StarterPlayerScripts |
Needed for player respawn and setup |
| Player Characters |
player.Character |
Managed by the engine on spawn/death |
| Scripts (usually) |
Script, LocalScript, ModuleScript |
Not typically destroyed directly; use carefully |