Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is this the right way to change GUI text based on player health?

Asked by
Prioxis 673 Moderation Voter
10 years ago

i'm designing a custom health gui because I despise the current one

while (true) do -- repeats to find health
health = game.Workspace:findFirstChild(script.Parent.Parent.Parent.Parent.Parent.Name).Humanoid.Health.Text = script.Parent.Text -- is Humanoid.Health.Text right or does it need to be changed to value?
return
end

I'm not on the studio right now to check if humanoid.Health is a text or value

0
I think it's a value, but then again it might be a string, and in that case you would have to use tonumber. systematicaddict 295 — 10y

1 answer

Log in to vote
0
Answered by
jav2612 180
10 years ago
while (true) do -- repeats to find health
    player = script.Parent.Parent.Parent.Parent.Parent
    if player.Character and player.Character:FindFirstChild("Humanoid") then
        script.Parent.Text = tostring(player.Character.Humanoid.Health) -- converts the Health  NumberValue to a string.
    end
end
0
Please use a code block to format your posts ;) duckwit 1404 — 10y
0
Yeah sorry about that I forget sometiems. jav2612 180 — 10y
Ad

Answer this question