Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Infinite yield possible on 'Players.ADAM6O00:WaitForChild("leaderstats")'?

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

I have the way I got 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

1 answer

Here is something to try. Make sure your leaderstats script isn't erroring. Then do this for the local script instead:

while wait() do
	local Plr = game.Players.LocalPlayer
	local stats = Plr:WaitForChild("leaderstats")
	local Strength = stats:WaitForChild("Strength")

	script.Parent.Text = "Strength: " .. Strength.Value
end

3 comments

0

also you could have formatted the other bit of script to

0

yooo thank you soo much ive been trying for an hour

0

np

This discussion is preserved as it was. New answers, comments, and votes are closed.