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

Is there a way to transform Humanoid.Health and Humanoid.MaxHealth to int values?

Asked by
Echtic 128
4 years ago

So this script basically makes it so your health is shown , i do have another one that refreshes it every time humanoid's health gets changed but it's not important here.

wait()

local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local hp = humanoid.Health
local maxhp = humanoid.MaxHealth

local frame = script.Parent

frame.Text =  hp .."/" .. maxhp

The problem is this: Every time the humanoid takes some damage that's not an integer, the text shows a number with a big amount of decimals. How do i round up all those numbers to integers?

1
math.floor(number + 0.5) DeceptiveCaster 3761 — 4y
0
Thanks bro! Say that as an answer so you can get some reputation, you surely deserve it! Echtic 128 — 4y

Answer this question