Hi, i’m trying to do a Health Display GUI, but when the life goes 90, she just desappear.
There’s a way for fix that?
I’m quite new on scripting, like not that new, but yeah, i am.
There’s the script
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local frame = script.Parent
humanoid.HealthChanged:Connect(function()
local percanage = humanoid.Health / humanoid.MaxHealth
if (percanage >= 0) then
frame:TweenSize(UDim2.fromScale(percanage, frame.Size.X.Scale))
print(percanage)
end
frame.Label.TextColor3 = Color3.fromHSV(0, 1, 1)
wait(0.1)
frame.Label.TextColor3 = Color3.fromHSV(0, 0, 1)
frame.Label.Text = math.floor(percanage * 100)
end)
I’m not good with arithmetics but “local percanage = humanoid.Health / humanoid.MaxHealth”
shouldn’t that be “local percanage = humanoid.Health / 100”
also you are just giving yourself a hard time by with this part
“frame.Label.Text = math.floor(percanage * 100)”
instead why don’t you just use
“frame.Label.Text = humanoid.Health”
I’m just reading trough it quickly so sorry if I missed something.