Why use Debris?
Temporary effects and projectiles can accumulate if nothing removes them. Debris:AddItem schedules cleanup without yielding the calling script.
Try it in Roblox Studio
Run this Script from ServerScriptService in Studio. The temporary Part appears briefly and then disappears.
Syntax
Debris:AddItem(instance, seconds)Examples
Debris cleanup
Create a temporary marker and remove it after five seconds.
local Debris = game:GetService("Debris")
local marker = Instance.new("Part")
marker.Name = "TemporaryMarker"
marker.Anchored = true
marker.Parent = workspace
Debris:AddItem(marker, 5)- The marker becomes visible when parented to Workspace.
- AddItem asks Debris to destroy it after the specified lifetime.
- The script keeps running; code should not assume marker still exists after its scheduled cleanup.
Best practices
- Use Debris for disposable instances, not persistent game state.
- Choose a lifetime long enough for the effect to be noticed but short enough to prevent clutter.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation