Waitforchild infinite when it exists?

local nametag = script:WaitForChild("Rank")
local groupId = 2752852
local MP = game:GetService("MarketplaceService")

game:GetService("Players").PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local head = char:WaitForChild("Head")
		local guiClone = nametag:Clone()
		guiClone.Parent = head
		guiClone.Tag.Text = plr.Name
		guiClone.Rank.Text = plr:GetRoleInGroup(groupId)
		
		if not MP:UserOwnsGamePassAsync(plr.UserId, 14334251) and plr.Name ~= "NeonSignalYT" then
			guiClone:WaitForChild("Tag").Rainbow.Disabled = true ( LINE 14 )
			guiClone:FindFirstChild("Tag").TextStrokeTransparency = 0.5
			guiClone:FindFirstChild("Tag").TextColor3 = Color3.new(1, 1, 1)
		else 
			guiClone:WaitForChild("Tag").Rainbow.Disabled = false
			guiClone:FindFirstChild("Tag").TextStrokeTransparency = 1
			guiClone:FindFirstChild("Tag").TextColor3 = Color3.new(255, 255, 255)
		end
	end)
end)

image

image

Error is on line 14 which is where I disable the rainbow.

That’s not an error. If you’re seeing Stack Begin, that means the Stack Started.
The script warns that and infinite yield is POSSIBLE, but then it runs in the next line. If your script still works then this must be an indicator.

Just to add though to your comment it will only run to the next line if it finds a child due to this being :WaitForChild (waiting for the child to spawn in)

Just add the second parameter. The second parameter is a delay number so if the thing isnt found itll skip over it.

example

local head = char:WaitForChild('Head', 3)

^ This would time out in 3 seconds if head wasn’t found. Most of the time prevents infinite yield error unless you have the path incorrect or its just not there in general.

The issue is that the path is correct, and the script doesn’t work bc of this error.

The script isn’t working tho… bc it can’t find the child yet it exists