I have a simple script that i have no clue why it wont work. The humanoid takes damage but doesnt change to value of health or change the humanoids health, even though the health bar above the character lowers.
health = game.Workspace.Objective.Humanoid.Health while true do wait(0.01) script.Parent.Text = ("Supply Health || " .. health) end
Im assuming that this code is the entire script in which case, you are only setting the variable health once. Instead you should also set it in the loop, so that every time the loop repeats it gets the current health instead of the health that was declared at the beginning of the script. Also instead of wait(0.01) try wait() So try this:
while true do wait() health = game.Workspace.Objective.Humanoid.Health script.Parent.Text = ("Supply Health || " .. health) end
Hope this helps.
ahhh here
health = workspace.Objective.Humanoid.Health health.Changed:connect(function() script.Parent.Text = "Supply Health || "..health end)
Using the changed function will make it so every time the objective health changes the text will update. This is more efficient because now this will lower the chance of unexpected breaks because
while true do
loops aren't good for anything. So if anything do
while wait() do
so breaks won't happen as often.