Infinite Yield Possible

I am getting an Infinite Yield Error on my tools when I reset. The line that’s getting the error is

if Humanoid.RigType == Enum.HumanoidRigType.R6 then
	LeftShoulder = Torso:WaitForChild("Left Shoulder") <-----this line and possibly the lines down
	RightShoulder = Torso:WaitForChild("Right Shoulder")
	OriginalLeftC0 = LeftShoulder.C0
	OriginalRightC0 = RightShoulder.C0
else
	Waist = Torso:WaitForChild("Waist")
	OriginalWaistC0 = Waist.C0
end

It breaks the tool/gun completely after dying.

1 Like

Infinite yield possible is a warning that appears if an object with that name doesn’t exist after WaitForChild waits for at least 5 seconds.

1 Like

I’m pretty sure that the motor6d returns before 5 seconds after death. I tried it and it still gives the error.

1 Like

Hey, wait. Is the BreakJointsOnDeath property of the humanoid set to true? If it is, then that’s why it’s happening. When it’s on, it will automatically delete all joints inside the model.

2 Likes

Oh, yeah that was the problem. I never thought about that. Thanks!

1 Like

Also, This may be something to do on my end but my roblox crashes whenever I reset.

1 Like

Sorry for Necrobumping, but important question, doesn’t the Motor6Ds return after player respawn? So pretty much, I try referencing the Motor6D’s with :WaitForChild() under torso.

*Note: the character the torso is under also goes through :WaitForChild()

Strange thing is, sometimes, The Motor6D is sucesfully initialized
But then sometimes it has infinite yield. Why is that?