while wait() do local player = game.Players.LocalPlayer script.Parent.Text = "Strength:" ..player:WaitForChild("leaderstats"):FindFirstChild("Strength").Value end This is in a local script and local script in a text label I am trying to put the leaderstats in a gui for my simulator game but its not working its giving me the error:Infinite yield possible on 'Players.Player1:WaitForChild("leaderstats")' please help
Infinite yield possible on 'Players.Player1:WaitForChild("leaderstats")'?
2 answers
Its just saying that there can be infinive things that can have the name u wait for
1 comment
i specified it as a child for the player(local player) but it didnt work
First of all, you are constantly defining the local player which can cause performance issues and you are also using an unnecessary loop, try this: JasiuJasiuB is wrong by the way, an infinite yield means an infinite wait not infinite items.
local player = game.Players.LocalPlayer
local stat = player:WaitForChild('leaderstats'):WaitForChild('Strength')
stat.Changed:Connect(function()
script.Parent.Text = "Strength:"..stat.Value
end)
3 comments
I don't get it i have the same error?
thiss is how i got the leader stats
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local strength = Instance.new("NumberValue") strength.Name = "Strength" strength.Parent = leaderstats
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Either leaderstats doesn't exist for a way too long time or you might've spelt it wrong or haven't specified its location well.
Its just saying that there can be infinive things that can have the name u wait for