Skip to main content

InstanceUtil

A collection of utility functions for working with Instances.

Types

AnimPlayInfo

type AnimPlayInfo = {}
FadeInTime: number?,
Weight: number?,
Speed: number?,
FadeOutTime: number?,

} A table of info for generating tweens for playing animations.

Functions

findFirstChildFromPredicate

InstanceUtil.findFirstChildFromPredicate(
parentInstance,--

The Instance to search the children of.

predicate(childInstance) → boolean,--

The predicate which determines whether the child was found.

recurseboolean?--

Whether or not to search the parent's descendants instead of just its children.

) → Instance?--

The first child whose name matches the given string.

Searches the parent for the first child which evaluates the given predicate to be true.

findFirstChildThatMatches

InstanceUtil.findFirstChildThatMatches(
parentInstance,--

The Instance to search the children of.

matchStringstring,--

The string to match the child's name to. Uses Lua's string.match function. Can take patterns.

recurseboolean?--

Whether or not to search the parent's descendants instead of just its children.

) → Instance--

The first child whose name matches the given string.

Searches the parent for the first child whose name matches the given string.

findFirstChildOfAncestor

InstanceUtil.findFirstChildOfAncestor(
descendantInstance,--

The Instance to find the ancestor of.

ancestorInstance--

The Instance to find the descendant's ancestor of.

) → Instance--

The first child of the ancestor that is an ancestor of the descendant.

Finds the first child of the given ancestor that is an ancestor of the given descendant. This is useful when you have a bunch of models in a folder and you have a reference to a part in one of these models. It allows you to quickly find which of those immediate children models the part is in.

getDescendantsWhichIsA

InstanceUtil.getDescendantsWhichIsA(
ParentInstance,--

Instance to perform the search on.

ClassNamestring | {string}--

The class name or names the descendant must match or inherit.

) → {Instance?}--

Table with valid descendants of passed ClassName.

Iterates through Parent descendants and returns a table which only contains descendants of passed ClassName.

waitForChildFromPredicate

InstanceUtil.waitForChildFromPredicate(
parentInstance,--

The Instance to search the children of.

predicate(childInstance) → boolean,--

The predicate which determines whether the child was found.

timeoutnumber?,--

The maximum amount of time to wait for the child to be added. Defaults to 10 seconds.

recurseboolean?--

Whether or not to search the parent's descendants instead of just its children.

) → Promise<Instance>--

A Promise resolving with the first child who satisfies the predicate.

Waits for the first child which evaluates the given predicate to be true.

waitForChildWhichIsA

InstanceUtil.waitForChildWhichIsA(
ancestorInstance,--

The Instance to search the children of.

classNamestring,--

The class of the child to wait for.

timeout?number?--

The maximum amount of time to wait for the child to be added. Defaults to 10 seconds.

) → Promise<Instance>--

A promise that resolves with the child when it is added.

Waits for a child of the given class in the given ancestor to be added.

waitForChildThatMatches

InstanceUtil.waitForChildThatMatches(
ancestorInstance,--

The Instance to search the children of.

matchStringstring,--

The string to match the child's name to. Uses Lua's string.match function. Can take patterns.

timeoutnumber?,--

The maximum amount of time to wait for the child to be added. Defaults ot 10 seconds.

recurseboolean?--

Whether or not to search the parent's descendants instead of just its children.

) → Promise<Instance>--

The first child whose name matches the given string.

Waits for the first child whose name matches the given string.

ensureInstance

InstanceUtil.ensureInstance(
parentInstance,--

The Instance to check.

templateInstance,--

The Instance to use as a template.

namestring?--

The name of the child to find. Uses the template's name if not given.

) → Instance--

The existing or new child.

Ensures that the given parent has a child with the given name. If not then it uses the given template to create a new child.

destroyFirstChild

InstanceUtil.destroyFirstChild(
parentInstance,--

The Instance to search the children of.

descendantNamestring,--

The name of the descendant to destroy.

recurseboolean?--

Whether or not to search the parent's descendants instead of just its children.

) → ()

Attempts to destroy a named descendant of the given parent.

safeDestroy

InstanceUtil.safeDestroy(
instanceInstance--

The Instance to destroy.

) → (
boolean,--

Whether or not the instance was destroyed. False is the instance was already destroyed.

string--

The error message if the instance could not be destroyed.

)

Attempts to destroy the given instance.

ensureAnimator

InstanceUtil.ensureAnimator(
ParentInstance--

The Parent to search for an Animator in.

) → Animator--

The Animator found or created.

Ensures the getting and creation of an Animator in the given Parent.

loadAnimAsync

InstanceUtil.loadAnimAsync(
SourceAnimatorAnimator,--

Animator to load the animation into.

AnimationToLoadAnimation--

The animation to load.

) → Promise<AnimationTrack>

Loads an animation asynchronously. Originally made to be used with models being displayed in ViewportFrames with Fusion.

weld

InstanceUtil.weld(
part1BasePart,--

The first part to weld.

part2BasePart--

The second part to weld.

) → WeldConstraint--

The WeldConstraint created.

Creates a WeldConstraint between two parts.

weldAssembly

InstanceUtil.weldAssembly(
modelModel,--

The Model to weld the parts of.

primaryPartBasePart?--

The Part to weld the parts to. Defaults to Model.PrimaryPart

) → {Weld}

Weld each individual part to the Model Model .PrimaryPart;

getAttachmentsAlignedCFrame

InstanceUtil.getAttachmentsAlignedCFrame(
partAttachmentAttachment,
targetAttachmentAttachment
) → CFrame

Gets the CFrame of the given partAttachment's parent needed to align with the targetAttachment. This is useful for aligning two parts such that their attachments are equivalent in CFrame.

info

This is effectively the same as using a RigidConstraint with the attachments if the parent part is unanchored.

getModelFitDistance

InstanceUtil.getModelFitDistance(
modelModel | BasePart,--

The Model to get the distance for.

vpfViewportFrame,--

The ViewportFrame to fit the model into.

cameraCamera?--

The Camera to use. Defaults to the ViewportFrame's CurrentCamera.

) → number--

The distance from the model the camera should be.

Gets the distance from the camera to the model that would fit the model in the viewport frame.

guaranteeAnchoringToAnimate

InstanceUtil.guaranteeAnchoringToAnimate(
modelModel | Actor--

Model to check and set .Anchor property to.

) → ()

Iterates through descendants of Model and unanchor necessary parts to play animations correctly.

emitParticles

InstanceUtil.emitParticles(
parentInstance,--

The Instance to search Particles for

emitCountnumber?--

The number of particles to emit

) → ()

Takes an Instance and Emits it and any descendants it has.

Optional Attributes that any of the descendant ParticleEmitters could have:

	EmitDelay: number? -- The delay before emitting
	EmitCount: number? -- The number of particles to emit at the start
	EmitDuration: number? -- The duration to emit particles for

cloneChildren

InstanceUtil.cloneChildren(
parentInstance,--

The Instance to take the children of

newParentInstance,--

The Instance to parent the cloned children to

predicate((objectInstance) → boolean)?--

A function to filter which children it should clone

) → {Instance}--

The cloned children

Takes an Instance and Clones all of its children into a new Instance.

promiseChild

InstanceUtil.promiseChild(
parentInstance,--

The Instance to take the children of

childNamestring,--

The Instance name to look for

timeoutnumber?--

The number of seconds to wait before timing out

) → Promise--

A Promise that resolves when the child is found or rejects if the timeout is reached.

Promisifys the WaitForChild method on an Instance and adds in more robust error handling.

isClass

InstanceUtil.isClass(
instanceInstance,--

The Instance to check the type of.

classNamesstring | {string}--

The ClassName or ClassNames to check against.

) → boolean--

Whether or not the instance is any of the given classes.

Checks to see if the given instance is any of the given classes.

fetchModule

InstanceUtil.fetchModule(
parentInstance,--

The Instance that has it and its descendants checked against.

moduleNamestring,--

The name of the ModuleScript to search for.

defaultValueany?--

The default value to return if the ModuleScript could not be found.

) → any

Searches for a ModuleScript in the given parent with the given name. If a descendant is found with the given name and is an ObjectValue, this value will be assumed to be the ModuleScript. If the ModuleScript could not be found it will return the defaultValue if it is provided. Otherwise it will error.

hasProperty

InstanceUtil.hasProperty(
objectInstance,--

The Instance to check the property of.

propertystring--

The property to check for.

) → (
boolean,--

Whether or not the instance has the property.

any--

The value of the property if it exists.

)

Checks to see if a given instance has a property. If it does, it will return true and the value of the property. If it does not, it will return false and a message.

playTracksAsync

InstanceUtil.playTracksAsync(
tracksAnimationTrack | {AnimationTrack},--

The AnimationTrack or array of AnimationTracks to play.

animInfoAnimPlayInfo?,--

The AnimPlayInfo to use when playing the tracks.

keyframeMarkerToResolveAtstring?--

The Keyframe marker to resolve at instead of the animations ending

) → Promise--

A Promise that resolves when all tracks have stopped playing.

Takes a track or array of AnimationTracks and plays them all asynchronously.

playTween

InstanceUtil.playTween(
objTween | Instance,--

The Tween to play or the instance to play on.

infoTweenInfo?,
goals{[string]any}?
) → Promise--

A Promise that resolves when the tween has finished.

Plays a tween as a promise. If a tween is not given then standard tween parameters are used to create a new tween.

Show raw api
{
    "functions": [
        {
            "name": "findFirstChildFromPredicate",
            "desc": "Searches the parent for the first child which evaluates the given predicate to be true.",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance to search the children of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "predicate",
                    "desc": "The predicate which determines whether the child was found.",
                    "lua_type": "(child: Instance) -> boolean"
                },
                {
                    "name": "recurse",
                    "desc": "Whether or not to search the parent's descendants instead of just its children.",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "The first child whose name matches the given string.",
                    "lua_type": "Instance?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 52,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "findFirstChildThatMatches",
            "desc": "Searches the parent for the first child whose name matches the given string.",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance to search the children of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "matchString",
                    "desc": "The string to match the child's name to. Uses Lua's string.match function. Can take patterns.",
                    "lua_type": "string"
                },
                {
                    "name": "recurse",
                    "desc": "Whether or not to search the parent's descendants instead of just its children.",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "The first child whose name matches the given string.",
                    "lua_type": "Instance"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 73,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "findFirstChildOfAncestor",
            "desc": "Finds the first child of the given ancestor that is an ancestor of the given descendant.\nThis is useful when you have a bunch of models in a folder and you have a reference to a part in one of these models.\nIt allows you to quickly find which of those immediate children models the part is in.",
            "params": [
                {
                    "name": "descendant",
                    "desc": "The Instance to find the ancestor of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "ancestor",
                    "desc": "The Instance to find the descendant's ancestor of.",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "The first child of the ancestor that is an ancestor of the descendant.",
                    "lua_type": "Instance"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 90,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "getDescendantsWhichIsA",
            "desc": "Iterates through Parent descendants and returns a table which only contains descendants of\npassed ClassName.",
            "params": [
                {
                    "name": "Parent",
                    "desc": "Instance to perform the search on.",
                    "lua_type": "Instance"
                },
                {
                    "name": "ClassName",
                    "desc": "The class name or names the descendant must match or inherit.",
                    "lua_type": "string | { string }"
                }
            ],
            "returns": [
                {
                    "desc": "Table with valid descendants of passed ClassName.",
                    "lua_type": "{Instance?}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 119,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "waitForChildFromPredicate",
            "desc": "Waits for the first child which evaluates the given predicate to be true.",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance to search the children of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "predicate",
                    "desc": "The predicate which determines whether the child was found.",
                    "lua_type": "(child: Instance) -> boolean"
                },
                {
                    "name": "timeout",
                    "desc": "The maximum amount of time to wait for the child to be added. Defaults to 10 seconds.",
                    "lua_type": "number?"
                },
                {
                    "name": "recurse",
                    "desc": "Whether or not to search the parent's descendants instead of just its children.",
                    "lua_type": "boolean?\n"
                }
            ],
            "returns": [
                {
                    "desc": "A Promise resolving with the first child who satisfies the predicate.",
                    "lua_type": "Promise<Instance>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 141,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "waitForChildWhichIsA",
            "desc": "Waits for a child of the given class in the given ancestor to be added.",
            "params": [
                {
                    "name": "ancestor",
                    "desc": "The Instance to search the children of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "className",
                    "desc": "The class of the child to wait for.",
                    "lua_type": "string"
                },
                {
                    "name": "timeout?",
                    "desc": "The maximum amount of time to wait for the child to be added. Defaults to 10 seconds.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "A promise that resolves with the child when it is added.",
                    "lua_type": "Promise<Instance>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 173,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "waitForChildThatMatches",
            "desc": "Waits for the first child whose name matches the given string.",
            "params": [
                {
                    "name": "ancestor",
                    "desc": "The Instance to search the children of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "matchString",
                    "desc": "The string to match the child's name to. Uses Lua's string.match function. Can take patterns.",
                    "lua_type": "string"
                },
                {
                    "name": "timeout",
                    "desc": "The maximum amount of time to wait for the child to be added. Defaults ot 10 seconds.",
                    "lua_type": "number?"
                },
                {
                    "name": "recurse",
                    "desc": "Whether or not to search the parent's descendants instead of just its children.",
                    "lua_type": "boolean?\n"
                }
            ],
            "returns": [
                {
                    "desc": "The first child whose name matches the given string.",
                    "lua_type": "Promise<Instance>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 201,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "getMass",
            "desc": "THIS METHOD IS DEPRECATED AS ASSEMBLYMASS TAKES FROM THE FULL ASSEMBLY\nGets the Total Mass of an Assembly.",
            "params": [
                {
                    "name": "assembly",
                    "desc": "The Instance to get the mass of.",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "The total mass of the assembly.",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "ignore": true,
            "source": {
                "line": 224,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "ensureInstance",
            "desc": "Ensures that the given parent has a child with the given name.\nIf not then it uses the given template to create a new child.",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance to check.",
                    "lua_type": "Instance"
                },
                {
                    "name": "template",
                    "desc": "The Instance to use as a template.",
                    "lua_type": "Instance"
                },
                {
                    "name": "name",
                    "desc": "The name of the child to find. Uses the template's name if not given.",
                    "lua_type": "string?"
                }
            ],
            "returns": [
                {
                    "desc": "The existing or new child.",
                    "lua_type": "Instance"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 243,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "destroyFirstChild",
            "desc": "Attempts to destroy a named descendant of the given parent.",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance to search the children of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "descendantName",
                    "desc": "The name of the descendant to destroy.",
                    "lua_type": "string"
                },
                {
                    "name": "recurse",
                    "desc": "Whether or not to search the parent's descendants instead of just its children.",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 259,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "safeDestroy",
            "desc": "Attempts to destroy the given instance.",
            "params": [
                {
                    "name": "instance",
                    "desc": "The Instance to destroy.",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the instance was destroyed. False is the instance was already destroyed.",
                    "lua_type": "boolean"
                },
                {
                    "desc": "The error message if the instance could not be destroyed.",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 272,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "ensureAnimator",
            "desc": "Ensures the getting and creation of an Animator in the given Parent.",
            "params": [
                {
                    "name": "Parent",
                    "desc": "The Parent to search for an Animator in.",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "The Animator found or created.",
                    "lua_type": "Animator"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 284,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "loadAnimAsync",
            "desc": "Loads an animation asynchronously. Originally made to be used with models being displayed in\nViewportFrames with Fusion.",
            "params": [
                {
                    "name": "SourceAnimator",
                    "desc": "Animator to load the animation into.",
                    "lua_type": "Animator"
                },
                {
                    "name": "AnimationToLoad",
                    "desc": "The animation to load.",
                    "lua_type": "Animation"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<AnimationTrack>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 312,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "weld",
            "desc": "Creates a WeldConstraint between two parts.",
            "params": [
                {
                    "name": "part1",
                    "desc": "The first part to weld.",
                    "lua_type": "BasePart"
                },
                {
                    "name": "part2",
                    "desc": "The second part to weld.",
                    "lua_type": "BasePart"
                }
            ],
            "returns": [
                {
                    "desc": "The WeldConstraint created.",
                    "lua_type": "WeldConstraint"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 336,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "weldAssembly",
            "desc": "Weld each individual part to the Model [Model] .PrimaryPart;",
            "params": [
                {
                    "name": "model",
                    "desc": "The Model to weld the parts of.",
                    "lua_type": "Model"
                },
                {
                    "name": "primaryPart",
                    "desc": "The Part to weld the parts to. Defaults to [Model].PrimaryPart",
                    "lua_type": "BasePart?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Weld }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 349,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "getAttachmentsAlignedCFrame",
            "desc": "Gets the CFrame of the given `partAttachment`'s parent needed to align with the `targetAttachment`.\nThis is useful for aligning two parts such that their attachments are equivalent in CFrame.\n:::info\nThis is effectively the same as using a RigidConstraint with the attachments if the parent part is unanchored.\n:::",
            "params": [
                {
                    "name": "partAttachment",
                    "desc": "",
                    "lua_type": "Attachment"
                },
                {
                    "name": "targetAttachment",
                    "desc": "",
                    "lua_type": "Attachment"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "CFrame\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 368,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "getModelFitDistance",
            "desc": "Gets the distance from the camera to the model that would fit the model in the viewport frame.",
            "params": [
                {
                    "name": "model",
                    "desc": "The Model to get the distance for.",
                    "lua_type": "Model | BasePart"
                },
                {
                    "name": "vpf",
                    "desc": "The ViewportFrame to fit the model into.",
                    "lua_type": "ViewportFrame"
                },
                {
                    "name": "camera",
                    "desc": "The Camera to use. Defaults to the ViewportFrame's CurrentCamera.",
                    "lua_type": "Camera?"
                }
            ],
            "returns": [
                {
                    "desc": "The distance from the model the camera should be.",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 380,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "guaranteeAnchoringToAnimate",
            "desc": "Iterates through descendants of Model and unanchor necessary parts to play animations correctly.",
            "params": [
                {
                    "name": "model",
                    "desc": "Model to check and set .Anchor property to.",
                    "lua_type": "Model | Actor"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 405,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "emitParticles",
            "desc": "Takes an Instance and Emits it and any descendants it has.\n\nOptional Attributes that any of the descendant ParticleEmitters could have:\n```\n\tEmitDelay: number? -- The delay before emitting\n\tEmitCount: number? -- The number of particles to emit at the start\n\tEmitDuration: number? -- The duration to emit particles for\n```",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance to search Particles for",
                    "lua_type": "Instance"
                },
                {
                    "name": "emitCount",
                    "desc": "The number of particles to emit",
                    "lua_type": "number?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 428,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "cloneChildren",
            "desc": "Takes an Instance and Clones all of its children into a new Instance.",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance to take the children of",
                    "lua_type": "Instance"
                },
                {
                    "name": "newParent",
                    "desc": "The Instance to parent the cloned children to",
                    "lua_type": "Instance"
                },
                {
                    "name": "predicate",
                    "desc": "A function to filter which children it should clone",
                    "lua_type": "((object: Instance) -> boolean)?\n"
                }
            ],
            "returns": [
                {
                    "desc": "The cloned children",
                    "lua_type": "{Instance}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 458,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "promiseChild",
            "desc": "Promisifys the WaitForChild method on an Instance and adds in more robust error handling.",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance to take the children of",
                    "lua_type": "Instance"
                },
                {
                    "name": "childName",
                    "desc": "The Instance name to look for",
                    "lua_type": "string"
                },
                {
                    "name": "timeout",
                    "desc": "The number of seconds to wait before timing out",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "A Promise that resolves when the child is found or rejects if the timeout is reached.",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 483,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "isClass",
            "desc": "Checks to see if the given instance is any of the given classes.",
            "params": [
                {
                    "name": "instance",
                    "desc": "The Instance to check the type of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "classNames",
                    "desc": "The ClassName or ClassNames to check against.",
                    "lua_type": "string | { string }"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the instance is any of the given classes.",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 506,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "fetchModule",
            "desc": "Searches for a ModuleScript in the given parent with the given name. If a descendant is found with the given name\nand is an ObjectValue, this value will be assumed to be the ModuleScript. If the ModuleScript could not be found\nit will return the defaultValue if it is provided. Otherwise it will error.",
            "params": [
                {
                    "name": "parent",
                    "desc": "The Instance that has it and its descendants checked against.",
                    "lua_type": "Instance"
                },
                {
                    "name": "moduleName",
                    "desc": "The name of the ModuleScript to search for.",
                    "lua_type": "string"
                },
                {
                    "name": "defaultValue",
                    "desc": "The default value to return if the ModuleScript could not be found.",
                    "lua_type": "any?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 527,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "hasProperty",
            "desc": "Checks to see if a given instance has a property. If it does, it will return true and the value of the property.\nIf it does not, it will return false and a message.",
            "params": [
                {
                    "name": "object",
                    "desc": "The Instance to check the property of.",
                    "lua_type": "Instance"
                },
                {
                    "name": "property",
                    "desc": "The property to check for.",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the instance has the property.",
                    "lua_type": "boolean"
                },
                {
                    "desc": "The value of the property if it exists.",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 558,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "playTracksAsync",
            "desc": "Takes a track or array of AnimationTracks and plays them all asynchronously.",
            "params": [
                {
                    "name": "tracks",
                    "desc": "The AnimationTrack or array of AnimationTracks to play.",
                    "lua_type": "AnimationTrack | { AnimationTrack }"
                },
                {
                    "name": "animInfo",
                    "desc": "The AnimPlayInfo to use when playing the tracks.",
                    "lua_type": "AnimPlayInfo?"
                },
                {
                    "name": "keyframeMarkerToResolveAt",
                    "desc": "The Keyframe marker to resolve at instead of the animations ending",
                    "lua_type": "string?\n"
                }
            ],
            "returns": [
                {
                    "desc": "A Promise that resolves when all tracks have stopped playing.",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 578,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        },
        {
            "name": "playTween",
            "desc": "Plays a tween as a promise. If a tween is not given then standard tween parameters are used to create a new tween.",
            "params": [
                {
                    "name": "obj",
                    "desc": "The Tween to play or the instance to play on.",
                    "lua_type": "Tween | Instance"
                },
                {
                    "name": "info",
                    "desc": "",
                    "lua_type": "TweenInfo?"
                },
                {
                    "name": "goals",
                    "desc": "",
                    "lua_type": "{ [string]: any }?\n"
                }
            ],
            "returns": [
                {
                    "desc": "A Promise that resolves when the tween has finished.",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 612,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "AnimPlayInfo",
            "desc": "\tFadeInTime: number?,\n\tWeight: number?,\n\tSpeed: number?,\n\tFadeOutTime: number?,\n}\nA table of info for generating tweens for playing animations.",
            "lua_type": "{",
            "source": {
                "line": 34,
                "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
            }
        }
    ],
    "name": "InstanceUtil",
    "desc": "A collection of utility functions for working with Instances.",
    "source": {
        "line": 10,
        "path": "src/railutils/src/RailUtil/InstanceUtil.lua"
    }
}