Informacje o wersji
Edukacja
Klasa silnika
Instance
Brak możliwości tworzenia
Brak możliwości przeglądania

*Ta zawartość została przetłumaczona przy użyciu narzędzi AI (w wersji beta) i może zawierać błędy. Aby wyświetlić tę stronę w języku angielskim, kliknij tutaj.


Podsumowanie
Metody
AddTag(tag: string):()
children():Instances
Przestarzałe
clone():Instance
Przestarzałe
Destroy():()
destroy():()
Przestarzałe
findFirstChild(name: string,recursive: boolean):Instance
Przestarzałe
GetAttribute(attribute: string):Variant
GetChildren():Instances
getChildren():Instances
Przestarzałe
GetDebugId(scopeLength: number):string
GetDescendants():Instances
GetStyled(name: string,selector: string?):Variant
isDescendantOf(ancestor: Instance):boolean
Przestarzałe
QueryDescendants(selector: string):Instances
Remove():()
Przestarzałe
remove():()
Przestarzałe
RemoveTag(tag: string):()
SetAttribute(attribute: string,value: Variant):()
WaitForChild(childName: string,timeOut: number):Instance
Członkowie odziedziczeni
Odziedziczone przez:

Materiały referencyjne dotyczące interfejsów API
Właściwości
Archivable
Odczyt równoległy
Instance.Archivable:boolean

archivable
Przestarzałe

Capabilities
Odczyt równoległy
Możliwości: CapabilityControl
Instance.Capabilities:SecurityCapabilities

Name
Odczyt równoległy
Instance.Name:string

Parent
Bez replikacji
Odczyt równoległy
Instance.Parent:Instance

PredictionMode
Tylko do odczytu
Bez replikacji
Brak możliwości dodawania do skryptu
Odczyt równoległy
Instance.PredictionMode:Enum.PredictionMode

RobloxLocked
Przestarzałe

Sandboxed
Bez replikacji
Odczyt równoległy
Możliwości: CapabilityControl
Instance.Sandboxed:boolean

UniqueId
Bez replikacji
Zabezpieczenia skryptów Roblox
Zabezpieczenia na platformie Roblox
Odczyt równoległy
Instance.UniqueId:UniqueId

Metody
AddTag
Instance:AddTag(tag:string):()
Parametry
tag:string
Zwroty
()

children
Przestarzałe

ClearAllChildren
Instance:ClearAllChildren():()
Zwroty
()

Clone
Możliwości: CreateInstances
Dostęp do symulacji
Instance:Clone():Instance
Zwroty
Przykłady kodu
Klona obiekt
local Workspace = game:GetService("Workspace")
-- Uzyskaj odniesienie do istniejącego obiektu
local model = script.Parent.Model
-- Utwórz klon modelu
local clone = model:Clone()
-- Przenieś klon, aby nie zachodził na oryginalny model
clone:PivotTo(model.PrimaryPart.CFrame - (Vector3.xAxis * 10))
-- Dodaj klon do Workspace
clone.Parent = Workspace

clone
Przestarzałe

Destroy
Instance:Destroy():()
Zwroty
()
Przykłady kodu
Instancja:Zniszcz()
local part = script.Parent.Part
part:Destroy()

destroy
Przestarzałe

FindFirstAncestor
Zapis równoległy
Instance:FindFirstAncestor(name:string):Instance?
Parametry
name:string
Zwroty

FindFirstAncestorOfClass
Zapis równoległy
Instance:FindFirstAncestorOfClass(className:string):Instance?
Parametry
className:string
Zwroty

FindFirstAncestorWhichIsA
Zapis równoległy
Instance:FindFirstAncestorWhichIsA(className:string):Instance?
Parametry
className:string
Zwroty

FindFirstChild
Zapis równoległy
Dostęp do symulacji
Instance:FindFirstChild(
name:string, recursive:boolean
Parametry
name:string
recursive:boolean
Wartość domyślna: false
Zwroty
Przykłady kodu
Instancja:ZnajdźPierwszegoDziecka
local found = workspace:FindFirstChild("Brick")
if found then
found.Name = "Foo"
end

findFirstChild
Przestarzałe

FindFirstChildOfClass
Zapis równoległy
Instance:FindFirstChildOfClass(className:string):Instance?
Parametry
className:string
Zwroty
Przykłady kodu
Instancja:ZnajdźPierwszegoDzieckaKlasy
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid
while not humanoid do
humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
character.ChildAdded:Wait()
end
end

FindFirstChildWhichIsA
Zapis równoległy
Dostęp do symulacji
Instance:FindFirstChildWhichIsA(
className:string, recursive:boolean
Parametry
className:string
recursive:boolean
Wartość domyślna: false
Zwroty

FindFirstDescendant
Zapis równoległy
Instance:FindFirstDescendant(name:string):Instance?
Parametry
name:string
Zwroty

GetActor
Zapis równoległy
Instance:GetActor():Actor?
Zwroty

GetAttribute
Zapis równoległy
Dostęp do symulacji
Instance:GetAttribute(attribute:string):Variant
Parametry
attribute:string
Zwroty
Variant

GetAttributeChangedSignal
Instance:GetAttributeChangedSignal(attribute:string):RBXScriptSignal
Parametry
attribute:string

GetAttributes
Zapis równoległy
Dostęp do symulacji
Instance:GetAttributes():Dictionary

GetChildren
Zapis równoległy
Dostęp do symulacji
Instance:GetChildren():Instances
Zwroty
Instances
Przykłady kodu
Instance:GetChildren
local children = workspace:GetChildren()
for i = 1, #children do
print(i, children[i].Name)
end

getChildren
Przestarzałe

GetDebugId
Brak możliwości przeglądania
Zabezpieczenia dodatku plug-in
Instance:GetDebugId(scopeLength:number):string
Parametry
scopeLength:number
Wartość domyślna: 4
Zwroty
Przykłady kodu
Instance:GetDebugId
print(workspace:GetDebugId()) --> 39FA_12
print(workspace:GetDebugId(10)) --> 39FA2FEF4D_12
print(workspace:GetDebugId(math.huge)) --> 12

GetDescendants
Zapis równoległy
Dostęp do symulacji
Instance:GetDescendants():Instances
Zwroty
Instances
Przykłady kodu
Instancja:GetDescendants
local descendants = workspace:GetDescendants()
-- Przejdź przez wszystkich potomków Workspace. Jeśli znajdziesz
-- BasePart, kod zmienia kolor tej części na zielony
for _, descendant in pairs(descendants) do
if descendant:IsA("BasePart") then
descendant.BrickColor = BrickColor.Green()
end
end

GetFullName
Zapis równoległy
Dostęp do symulacji
Instance:GetFullName():string
Zwroty
Przykłady kodu
Instance:GetFullName
-- Utwórz prostą hierarchię
local model = Instance.new("Model")
local part = Instance.new("Part")
part.Parent = model
local fire = Instance.new("Fire")
fire.Parent = part
print(fire:GetFullName()) --> Model.Part.Fire
model.Parent = workspace
print(fire:GetFullName()) --> Workspace.Model.Part.Fire
part.Name = "Witaj, świecie"
print(fire:GetFullName()) --> Workspace.Model.Witaj, świecie.Fire
Instancja:GetFullName Implementacja Lua
local function getFullName(object)
local result = object.Name
object = object.Parent
while object and object ~= game do
-- Dodaj nazwę rodzica na początku
result = object.Name .. "." .. result
-- Przejdź w górę hierarchii
object = object.Parent
end
return result
end
print(getFullName(workspace.Camera)) --> Workspace.Camera

GetStyled
Instance:GetStyled(
name:string, selector:string?
):Variant
Parametry
name:string
selector:string?
Zwroty
Variant

GetStyledPropertyChangedSignal
Instance:GetStyledPropertyChangedSignal(property:string):RBXScriptSignal
Parametry
property:string

GetTags
Zapis równoległy
Dostęp do symulacji
Instance:GetTags():{any}
Zwroty

HasTag
Zapis równoległy
Dostęp do symulacji
Instance:HasTag(tag:string):boolean
Parametry
tag:string
Zwroty

IsAncestorOf
Zapis równoległy
Dostęp do symulacji
Instance:IsAncestorOf(descendant:Instance):boolean
Parametry
descendant:Instance
Zwroty
Przykłady kodu
Instance:IsAncestorOf()
local Workspace = game:GetService("Workspace")
local spawnLocation = Workspace.SpawnLocation
local decal = spawnLocation.Decal
-- Te stwierdzenia są prawdziwe
print(Workspace:IsAncestorOf(spawnLocation))
print(Workspace:IsAncestorOf(decal))
print(spawnLocation:IsAncestorOf(decal))
-- Te stwierdzenia są fałszywe
print(spawnLocation:IsAncestorOf(Workspace))
print(decal:IsAncestorOf(Workspace))
print(decal:IsAncestorOf(spawnLocation))

IsDescendantOf
Zapis równoległy
Dostęp do symulacji
Instance:IsDescendantOf(ancestor:Instance):boolean
Parametry
ancestor:Instance
Zwroty
Przykłady kodu
Instancja:CzyPotomek
local part = Instance.new("Part")
print(part:IsDescendantOf(game))
--> fałsz
part.Parent = workspace
print(part:IsDescendantOf(game))
--> prawda
part.Parent = game
print(part:IsDescendantOf(game))
--> prawda

isDescendantOf
Przestarzałe

IsPropertyModified
Dostęp do symulacji
Instance:IsPropertyModified(property:string):boolean
Parametry
property:string
Zwroty

QueryDescendants
Dostęp do symulacji
Instance:QueryDescendants(selector:string):Instances
Parametry
selector:string
Zwroty
Instances

Remove
Przestarzałe

remove
Przestarzałe

RemoveTag
Instance:RemoveTag(tag:string):()
Parametry
tag:string
Zwroty
()

ResetPropertyToDefault
Instance:ResetPropertyToDefault(property:string):()
Parametry
property:string
Zwroty
()

SetAttribute
Dostęp do symulacji
Instance:SetAttribute(
attribute:string, value:Variant
):()
Parametry
attribute:string
value:Variant
Zwroty
()

WaitForChild
Możliwy wynik
Instance:WaitForChild(
childName:string, timeOut:number
Parametry
childName:string
timeOut:number
Zwroty
Przykłady kodu
Instancja:WaitForChild
local part = workspace:WaitForChild("Part")
print(part.Name .. " został dodany do Workspace")

Zdarzenia
AncestryChanged
Instance.AncestryChanged(
child:Instance, parent:Instance
Parametry
child:Instance
parent:Instance
Przykłady kodu
Instance.AncestryChanged
local Workspace = game:GetService("Workspace")
local redPart = script.Parent.RedPart
local bluePart = script.Parent.BluePart
local changingPart = script.Parent.ChangingPart
-- Zmień kolor changingPart w zależności od jego Rodzica
local function onAncestryChanged(part: Part, parent: Instance)
if parent == redPart then
changingPart.Color = Color3.new(1, 0, 0)
elseif parent == bluePart then
changingPart.Color = Color3.new(0, 0, 1)
else
changingPart.Color = Color3.new(1, 1, 1)
end
print(`{part.Name} jest teraz rodzicem {parent.Name}`)
end
changingPart.AncestryChanged:Connect(onAncestryChanged)
-- Ustaw właściwość Rodzica changingPart na różne instancje w czasie
while true do
task.wait(2)
changingPart.Parent = redPart
task.wait(2)
changingPart.Parent = bluePart
task.wait(2)
changingPart.Parent = Workspace
end

AttributeChanged
Instance.AttributeChanged(attribute:string):RBXScriptSignal
Parametry
attribute:string

ChildAdded
Instance.ChildAdded(child:Instance):RBXScriptSignal
Parametry
child:Instance
Przykłady kodu
Instance.ChildAdded
local function onChildAdded(instance)
print(instance.Name .. " dodano do workspace")
end
workspace.ChildAdded:Connect(onChildAdded)
local part = Instance.new("Part")
part.Parent = workspace --> Część dodana do Workspace

childAdded
Przestarzałe

ChildRemoved
Instance.ChildRemoved(child:Instance):RBXScriptSignal
Parametry
child:Instance
Przykłady kodu
Instance.ChildRemoved
local function onChildRemoved(instance)
print(instance.Name .. " usunięty z przestrzeni roboczej")
end
workspace.ChildRemoved:Connect(onChildRemoved)
local part = Instance.new("Part")
part.Parent = workspace
task.wait(2)
part:Destroy()

DescendantAdded
Instance.DescendantAdded(descendant:Instance):RBXScriptSignal
Parametry
descendant:Instance
Przykłady kodu
Instance.DescendantAdded
local function onDescendantAdded(descendant)
print(descendant)
end
workspace.DescendantAdded:Connect(onDescendantAdded)
local part = Instance.new("Part")
part.Parent = workspace

DescendantRemoving
Instance.DescendantRemoving(descendant:Instance):RBXScriptSignal
Parametry
descendant:Instance
Przykłady kodu
Instance.DescendantRemoving
workspace.DescendantRemoving:Connect(function(descendant)
print(descendant.Name .. " jest obecnie przypisany do " .. tostring(descendant.Parent))
end)
local part = Instance.new("Part")
part.Parent = workspace
part.Parent = nil
--> Część jest obecnie przypisana do Workspace
print(part.Parent)
--> nil

Destroying
Instance.Destroying():RBXScriptSignal
Przykłady kodu
Użycie wydarzenia niszczenia (sygnały natychmiastowe)
local part = Instance.new("Part", workspace)
local function onPartDestroying()
print("Przed wywołaniem yield:", part:GetFullName(), #part:GetChildren())
task.wait()
print("Po wywołaniu yield:", part:GetFullName(), #part:GetChildren())
end
part.Destroying:Connect(onPartDestroying)
part:Destroy()
Używanie zdarzenia niszczenia (Opóźnione sygnały)
local part = Instance.new("Part", workspace)
local function onPartDestroying()
print("W sygnale:", part:GetFullName(), #part:GetChildren())
end
part.Destroying:Connect(onPartDestroying)
print("Przed zniszczeniem:", part:GetFullName(), #part:GetChildren())
part:Destroy()
print("Po zniszczeniu:", part:GetFullName(), #part:GetChildren())

StyledPropertiesChanged
Instance.StyledPropertiesChanged():RBXScriptSignal

©2026 Roblox Corporation. Nazwa Roblox, logo Roblox oraz hasło „Powering Imagination” należą do naszych zarejestrowanych i niezarejestrowanych znaków towarowych na terenie Stanów Zjednoczonych oraz w innych krajach.