What is Yielder X?
It is a module script made for personal use that acts as a customizable version of WaitForChild()
You can also search for multiple objects inside an instance simultaneously and yield a property until it isn’t nil (One use is for the player’s character since it is a property).
Model: YielderX - Roblox
How does it work?
Yielder X runs on a basic concept: If the object you’re trying to find doesn’t exist, it will wait a few seconds and try find it again, then repeats that process until it hits the maximum amount of attempts or until the object is no longer nil.
Once it does reach max attempts, it will terminate the yield and you can handle what happens when finding that object fails.
Usage:
-- Essential variables:
local yielderX = require( ... )
local objectToSearch = player.Character
local objectsToFind = {"HumanoidRootPart", "Left Leg"}
if yielderX.yield(objectsToFind, objectToSearch}) == nil then
print("The objects have not been found.")
-- You can decide how to handle it.
return
end
print("Found HRP and Left Leg")
Practical Examples:
In this script, it will yield the player’s character, it’s humanoid and head, as well as a non-existent object.
Output:
Side notes:
- If one of the objects in the table of things you’re trying to find is nil after the max attempt, it will outcome as nil for everything.
- The things you want to search must be strings of their names in a table