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

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

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

1 comment

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.

1 answer

✓ Accepted answer
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

2 comments

0

Please use a code block to format your posts ;)

0

Yeah sorry about that I forget sometiems.

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