By versatile in exact terms, I mean if a character's maxhealth was more or less than 100, how can I size my Health Bar?
while wait() and plr.Character do script.Parent.Size = UDim2.new(plr.Character.Humanoid.Health/100,0,1,0) end
This script works at any MaxHealth, but the size of the GUI either larger or smaller depending on its max health. I want the overall size of the GUI to stay the same whether or not the max health changes. How can I go about doing this?
There is a property named "MaxHealth" in the Humanoid. It is the Player's maximum amount of health. This will be what you need. Let me show you the script.
while wait() and plr.Character do script.Parent.Size = UDim2.new(plr.Character.Humanoid.Health/plr.Character.Humanoid.MaxHealth,0,1,0) end
Any questions? Please leave a comment below. Thanks and I hope this will help!