Debrisクラス
ひとことで言うと
指定した時間がたったら、インスタンスを自動で削除してくれるサービスです。
公式の説明(英語):Allows scheduling the guaranteed destruction of an object without yielding.
使用例
local Debris = game:GetService("Debris")
local part = Instance.new("Part")
part.Position = Vector3.new(0, 20, 0)
part.Parent = workspace
Debris:AddItem(part, 5)スクリプトは、Luauの型チェック(luau-lsp)で確認しています。
クラスの関係
メソッド(1)
| 名前と書き方 | 説明 |
|---|---|
AddItemDebris:AddItem(item: Instance, lifetime: double): () | インスタンスと秒数を指定すると、その時間がたったあとに削除します。Schedules a given Instance for destruction within the specified lifetime. |
受け継いでいるメンバー
Instance から受け継いでいるもの(46)
Archivable・Capabilities・IsInSandbox・Name・Parent・PredictionMode・Sandboxed・AddTag・ClearAllChildren・Clone・Destroy・FindFirstAncestor・FindFirstAncestorOfClass・FindFirstAncestorWhichIsA・FindFirstChild・FindFirstChildOfClass・FindFirstChildWhichIsA・FindFirstDescendant・GetActor・GetAttribute・GetAttributeChangedSignal・GetAttributes・GetChildren・GetDebugId・GetDescendants・GetFullName・GetStyled・GetStyledPropertyChangedSignal・GetTags・HasTag・IsAncestorOf・IsDescendantOf・IsPropertyModified・QueryDescendants・RemoveTag・ResetPropertyToDefault・SetAttribute・WaitForChild・AncestryChanged・AttributeChanged・ChildAdded・ChildRemoved・DescendantAdded・DescendantRemoving・Destroying・StyledPropertiesChanged
Object から受け継いでいるもの(4)
Debrisを使う記事
英語の説明とメンバーの一覧は、Roblox Creator Documentation(Debris)をもとにしています(CC BY 4.0)。日本語の解説は、このサイトで独自に書いたものです。