I am making a health bar but the problem is the current health is a float and when the player gets damaged it shows a very large float number with many numbers, So I tried flooring it but the error in the title popped up

LocalScript:

local label = script.Parent
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
while true do
	wait(0.2)
	local math = ( Humanoid.Health / Humanoid.MaxHealth )
	label.Text = math.floor(Humanoid.Health).."/"..Humanoid.MaxHealth
	label.Parent.Health.Size = UDim2.new(Humanoid.Health/Humanoid.MaxHealth,0,1,0)
end

4 comments

0

change line 5 to something other than math

0

Oh, I didn't need that anyways lol. Thanks!

0

Make sure to edit your title it contains [SOLVED]

0

Done.