So, I created a healthbar gui for my monster and I configure its health into 500 MaxHealth and 500 Health but, now, my problem is when I’m trying to get the scale of healthbar into 1 the value becomes 5.
If you want to get percentage, you have to multiply the result by 100.
But your use should work just fine, how you sent it. Are you sure you’re using Scale and not Offset with the Frame? In the script – you’re setting Scale, make sure to check it.
That’s not mathematically possible.
1 / 500 * 500 is 1…
so if the monster is at full health the frame scale should be 1… likewise
1 / 500 * 250 is 0.5…
so if the monster is at 250 health, the frame scale should be 0.5
So, I make a LocalScript and put it in the StarterGui.
Localscript:
while wait(5) do
local monster = game:GetService("Workspace"):WaitForChild("Killers"):WaitForChild("Jaguar")
local boss = monster:WaitForChild("Zombie")
local bossHealth = boss.Health
local bossMaxHealth = boss.MaxHealth
print("Formula 1: "..(1/bossMaxHealth) * bossHealth)
print("Formula 2: "..bossHealth/bossMaxHealth)
end