So, I’m trying to advance my proficiency in Lua, and I figured I’d see how to make a HUD. I knew the basic draw.RoundedBox shit, or the ol’ vgui.Create( “D[DEL]ick[/DEL]Frame” ). But I wanted to further my knowledge of vgui. Now, I watched the following video:
At around 4 minutes in, you can see that he’s making it so the health bar will not extend it’s capacity/vise versa.
He does the following:
local DrawHealth = LocalPlayer():Health() if DrawHealth > 100 then DrawHealth = 100 end if DrawHealth < 0 then DrawHealth = 0 end if DrawHealth != 0 then draw.RoundedBox( 0, 17, ScrH() - 143, 326 * DrawHealth / 100, 26, Color( 255, 0, 0, 255 ) ) end
Now… My question is:
Why the hell does it work?! Would this not make your health actually go down to 100, if you increase it to… Say 200?
I mean… I think I know, however, I’m learning, so I’d like to confirm… This is clientside… The server handles your health. That’s why I think this works… Is this true?