AddItem (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy
fixed
>SoulStealer9875
No edit summary
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<onlyinclude>{{Method
<onlyinclude>{{Method
|name = AddItem
|name = AddItem
|arguments = [[Instance]] item, [[Number]] lifetime [default: 10]
|arguments = [[Instance]] ''item'' [, [[Number]] lifetime = 10]
|returns = [[nil]]
|description = Adds that item to the Debris service, which will remove the item after the lifetime has expired, or the number of the debris items exceeds the [[MaxItems]] limit.
|description = Adds that item to the Debris service, which will remove the item after the lifetime has expired, or the number of the debris items exceeds the [[MaxItems]] limit.
|object = [[Debris]]
|object = Debris
}}</onlyinclude>
}}</onlyinclude>
{{clear floats}}
== Description ==
== Description ==
The Add Item function is used with the [[Debris]] service. When you add an item it gets added to the list of what the game considers to be clutter on the map. After the '''lifetime''' limit has expired, the item will be removed. Or, if there are too many clutter items around and you hit the [[MaxItems]] limit, the oldest items will be removed until the number of clutter objects is back under the limit.
The Add Item function is used with the [[Debris]] service. When you add an item it gets added to the list of what the game considers to be clutter on the map. After the '''lifetime''' limit has expired, the item will be removed. Or, if there are too many clutter items around and you hit the [[MaxItems]] limit, the oldest items will be removed until the number of clutter objects is back under the limit.
{{Example|<pre>
game:GetService("Debris"):AddItem(game.Workspace.Message, 5)
</pre>
Removes the Message under Workspace after five seconds.}}
[[Category:Methods]]
[[Category:Methods]]

Latest revision as of 11:44, 16 July 2011

AddItem( Instance item [, Number lifetime = 10] )
Returns nil
Description: Adds that item to the Debris service, which will remove the item after the lifetime has expired, or the number of the debris items exceeds the MaxItems limit.
Member of: Debris


Description

The Add Item function is used with the Debris service. When you add an item it gets added to the list of what the game considers to be clutter on the map. After the lifetime limit has expired, the item will be removed. Or, if there are too many clutter items around and you hit the MaxItems limit, the oldest items will be removed until the number of clutter objects is back under the limit.

Example
game:GetService("Debris"):AddItem(game.Workspace.Message, 5)
Removes the Message under Workspace after five seconds.