Methods

:GetChildren()

Returns a table containing all of the direct children of the Instance.

for _, child in ipairs(game.Workspace:GetChildren()) do
    print(child.Name)
end

:IsA(string: className)

checks if the instance is of the same Class as the className


:GetDescendants()

Returns a table containing all objects parented to the Instance at any depth (children, children's children, etc.).

for _, descendant in ipairs(game.Workspace:GetDescendants()) do
    if descendant.ClassName == "Humanoid" then
        print("Found a humanoid:", descendant.Parent.Name)
    end
end

:FindFirstChild(string: name)

Searches for a direct child with the given name. This is faster than iterating through :GetChildren().

local camera = game.Workspace:FindFirstChild("Camera")
if camera then
    -- do something
end

:FindFirstChildOfClass(string: className)

Searches for a direct child with the given ClassName.

local humanoid = game.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")

:IsDescendantOf(Instance: ancestor)

Checks if the instance is a descendant of the specified ancestor object. This means it is a child, a child of a child, and so on

local part = game.Workspace.MyCharacter.Head
local character = game.Workspace.MyCharacter

if part:IsDescendantOf(character) then
    print("The Head is a descendant of the Character.")
end

:IsAncestorOf(Instance: descendant)

Checks if the instance is an ancestor of the specified descendant object. This is the reverse of :IsDescendantOf().

local character = game.Workspace.MyCharacter
local rightHand = character.RightHand

if character:IsAncestorOf(rightHand) then
    print("The Character is an ancestor of the RightHand.")
end

:FindFirstAncestor(string: name)

Searches up the hierarchy from the instance's parent and returns the first ancestor found with the given name. If no ancestor is found, it returns nil.

local enginePart = game.Workspace.MyCar.Engine.EngineBlock
local carModel = enginePart:FindFirstAncestor("MyCar")

if carModel then
    print("Found the car model:", carModel.Name)
end

:FindFirstAncestorOfClass(string: className)

Searches up the hierarchy and returns the first ancestor that is of the specified class.

local humanoid = game.LocalPlayer.Character.Head:FindFirstAncestorOfClass("Humanoid")
if humanoid then
    print("Found the humanoid by searching up from the Head.")
end

:FindFirstDescendant(string: name)

Searches through all descendants of an instance and returns the first one found with the given name. This is useful for finding a specific part without knowing its exact location.

local character = game.LocalPlayer.Character
local specialPart = character:FindFirstDescendant("EffectPart")

if specialPart then
    print("Found the effect part somewhere in the character model.")
end

:FindFirstDescendantOfClass(string: className)

Searches through all descendants of an instance and returns the first one found with the specified ClassName.

local player = game.Players.LocalPlayer
local a_humanoid = player:FindFirstDescendantOfClass("Humanoid")

if a_humanoid then
    print("Found a humanoid within the player instance!")
end

:SetHighlightOnTop()

Makes the Highlight Instance render on top of walls.


:SetHighlightTransparency(float: transparency)

Sets the transparency of the highlight effect.


Last updated