Weird bug with Property Changed Signal?

This script doesn’t change the health textlabel text for some reason, and no prints in the output.
script:

local plr = script.Parent.plr.Value

while wait(1) do
	timer += 1
	if timer % 100 == 0 then
		plr.leaderstats.Coins.Value += 50
	end
	
	script.Parent.TextLabel.Text = tostring(timer).."s"
end

plr.Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
	print("here")
	script.Parent.TextLabel2.Text = tostring(plr.Character.Humanoid.Health)
end)

Thanks!
(I am currently seeing if its the while loop)

SOLUTION: It is because of the while loop.

You could also wrap it in a coroutine (if it’s necessary for the loop to run)

coroutine.wrap(function()
   -- loop here
end)()
1 Like

Yeah I know that, just forgot about it

1 Like