I'm on a wiki lesson on Roblox that makes a custom player info Gui in the top right corner of the screen, but the local script isn't working, and I even plugged in the wiki lesson's local script and that STILL didn't work. The error is this
12:31:06.196 - Infinite yield possible on Players.GreekGodOfMLG.PlayerGui.PlayerHub.PlayerInfo:WaitForChild("Avatar")
I have encountered this error multiple times before when I used WaitForChild, but I'm stumped on how to fix this issue, can you guys help me? Here's my code that I wrote, kind of changed some parts of it to make it more comfortable for me.
--\\ Services/Labels
local Player = game:GetService('Players').LocalPlayer
local PlayerInfo = script.Parent
--\\ Character of player info
PlayerInfo:WaitForChild('Avatar').Image = 'http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&username=' .. Player.Name
PlayerInfo:WaitForChild('ClientName').Text = Player.Name
--\\ Health function/info
local HealthBar = game:WaitForChild('HealthBar')
Player.CharacterAdded:connect(function(Character)
local Humanoid = Character:WaitForChild('Humanoid')
Humanoid.HealthChanged:Connect(function(Health)
local HealthPercentage = Health / Character.Humanoid.MaxHealth
HealthBar.Size = UDim2.new(HealthPercentage, 0, 1, 0)
end)
end)
--//Disabling default health bar
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health,false)
Hopefully, I explained myself the best I can and my situation.
Here's the lesson I am learning off if it helps or you want to check it out for yourself.
Greek

1 comment
Intresting, guess I gotta rewrite some code, thanks!