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

[SOLVED]HealthBackground.TextLabel.LocalScript:6: attempt to index local 'math' (a number value)?

Asked by 5 years ago
Edited 5 years ago

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
0
change line 5 to something other than math User#19524 175 — 5y
0
Oh, I didn't need that anyways lol. Thanks! mixgingengerina10 223 — 5y
0
Make sure to edit your title it contains [SOLVED] User#19524 175 — 5y
0
Done. mixgingengerina10 223 — 5y

Answer this question