What I'm trying to do is make a custom health bar GUI, it works, but instead of having numbers like 61.012410005 it would round to the nearest whole number.
My code.
local percent = script.Parent.Indicator.Percent
local indicator = script.Parent.Indicator
local player = game.Players.LocalPlayer
workspace:WaitForChild(player.Name)
local char = game.Workspace[player.Name].Humanoid
char.Changed:connect(function()
indicator.Size = UDim2.new(char.Health/100, 0, 1, 0)
percent.Text = char.Health
end)
--to test it
local takeaway = math.random(1,50)
wait(20)
char.Health = char.Health - takeaway

1 comment
10x more simpler than my way of rounding xD