Infinite yield when trying to find Torso

So as I was aware, people had Display Names and were able to keep it
As a result they have their names above their head display their Display Name.

But there’s a problem with that
When my code tries to WaitForChild(“Torso”) a player with a Display Name, it returns an infinite yield.

He reset his character twice before this screenshot was taken:

There were about 20 people in the server, but only he (as far as I know) have this problem.

He tried resetting, and even rejoining the game and same results occurred.
Only he (as far as I know) has a Display Name in that following server, therefore I suspect that the Display Names are causing this problem.

local char = workspace:WaitForChild(plr.Name)
local T = char:WaitForChild("Torso")

Why don’t you just utilize plr.Character? It is easier than looking for it in workspace.

local char = plr.Character or plr.CharacterAdded:Wait()
local T = char:WaitForChild("Torso")

I’ll try that and see what happens

Is your game R6 or R15 since if it’s R15 you would look for the upper torso or lower torso also why are you looking for the torso in workspace instead of using
local plr = game:GetService(“Players”).LocalPlayer
local char = plr.character
Local t = char:WaitForChild(“Torso”)

1 Like

It is fully R6, so I didn’t need to check for UpperTorso or LowerTorso

1 Like

An infinite yield is a warning that warns that you that a script might wait forever to wait for a child that either hasn’t loaded in, is non-existent, or is parented somewhere else.
– scripting helpers, Rare_tendo

When you reset, you will get a new torso and it might not have loaded in for 5 seconds when the script ran the

WaitForChild()

so therefore it gave you a warning it might wait forever

The script that used it is located in a tool, in Starterpack, so it would reset along with the player. That shouldn’t be worried because it worked fine before and suddenly it doesn’t

Its actually a warning so it shouldn’t affect your script…
It did not affect your script as some famous script has it too but it still worked perfectly

I first replaced the code with

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharcterAdded:Wait()

And the code breaks every time I reset so I went ahead and replaced it with this

local plr = game.Players.LocalPlayer
local char = plr.CharcterAdded:Wait() or workspace:WaitForChild(plr.Name)

And everything went back to normal
So it looks like Display Names weren’t the issue after all : ]