rbx-yield-for-character-parts

Yield until all members of a character rig exist, then dot access!

Usage no npm install needed!

<script type="module">
  import rbxYieldForCharacterParts from 'https://cdn.skypack.dev/rbx-yield-for-character-parts';
</script>

README

Yield for Character Parts

Usage:

Pass a Player's Character Model into yieldForR15CharacterDescendants or yieldForR6CharacterDescendants, which will yield via WaitForChild until all the members defined in the code exist (all members except those generated by Sound/Animate scripts). The function will return a promise, and, once these members exist, the model with all its members defined will be accessible through the then method.

yieldForR15CharacterDescendants(character).then(CharR15 => {
    // All members are properly typed and defined!
    CharR15.Head.face.Texture = ""
});

Meant to be used with rbx-safe-types, although it should also work with rbx-types.