Health textlabel to int number

Hello! I would like to know how to make the number shown in the textlabel (Humanoid health) convert into int number.

gg

My code:

local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

while wait() do
	script.Parent.Text = humanoid.Health.."/100"
end

math.floor(humanoid.Health) or math.ceil(humanoid.Health)

1 Like

Math.floor returns a number without all of the decimals. To round up we can do math.floor(number + 0.5)

local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

while wait() do
    local number = math.floor(0.5 +  humanoid.Health/100)
	script.Parent.Text = number.." /100"
end

Thanks a lot! it worked perfectly for me :smiley:

No problem! :slight_smile: Have a good day

1 Like