I have this small code for a health bar:
It's in a local script
local player = game.Players.LocalPlayer
local health = player:WaitForChild("Humanoid").Health
player.Humanoid.Changed:connect(function()
script.Parent.Size = UDim2.new(0,health*3.6,2,0)
end)
What this does is make the size of the bar the number of health the humanoid.
But if I made the bar only 100 it would be too small so I added the health*3.6 to make it look normal.
In my screen it's perfect but in other peoples screens it only appears half the bar.
I tried using a plugin but it didn't work.
Is there any way to make my script know how full the bar needs to be relatively to the player's health?
Like for it to be full when the health is 100 and half when the health is 50.
Some sort of calculation, or something I am missing..
Sorry if this is a dumb question I just can't seem to figure it out.
Thanks for whoever helps me with this! :)

1 comment
I recommend to use Size.Scale instead Size.Offset