game.Players.PlayerAdded:connect(function(p)
local leaderstat = Instance.new("Model")
leaderstat.Name = "leaderstat"
leaderstat.Parent = p
local c = Instance.new("StringValue")
c.Name = "coords"
c.Value = 2
c.Parent = leaderstat
end)
game.Players.PlayerAdded:connect(function(p)
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = p
local hunger = Instance.new("NumberValue")
hunger.Name = "Hunger"
hunger.Value = 100
hunger.Parent = leaderstats
local thirst = Instance.new("NumberValue")
thirst.Name = "thirst"
thirst.Value = 100
thirst.Parent = leaderstats
end)
print("here here")
player = game.Players.LocalPlayer
print("code blue")
local e = false
if player.Hunger.Value <= 10 then
e = true
while e do
wait(2)
player.Character.Humanoid.Health = player.Character.Humanoid.Health - 10
end
end
if player.Character.Humanoid.Health <= 0 then
e = false
end
basically, this is for a hunger stat. it does the leaderstats part perfectly, but it doesnt print code blue. it doees print here here, which is why i know the waitforchild is messing up. am i using it wrong? or is it something else?

3 comments
is this a local scirpt?
no, why would it be.
IF you using LocalPlayer, then the script has to be a local script or else it won't work