How to center the position of DrawText



draw.DrawText(client:GetNetworkedInt("money").. " PB" , "mula", 75, 760, Color(0, 111, 3, 255), 0, 0)


I’m having trouble with a health bar I made and the money on it is always off to the sides because when I develope the code I see a certain amount of “money” so when I align that with the center of the health bar it doesnt really center for people who have 0 money or people who have more money then I do.

I was wondering if there was a way to center the text so that when “money” gets higher it doesnt just push to the right but push the text both ways = CENTER IT. So If someone could help anytime soon that’d be super.

Try using
[lua]
draw.DrawText(client:GetNetworkedInt(“money”)… " PB" , “mula”, 75, 760, Color(0, 111, 3, 255), 1)
[/lua]
The number one at the end tells the function to center the text.
You may have to adjust the x position of the text to make sure it defaults at the same place.

draw.DrawText( text, font, x, y, color, TEXT_ALIGN_CENTER )

We have the enums, we should use them.

Numbers are .00000000001 second faster, you should use those.

/deco

Enums are defined through C++ and are the correct values. If garry changes what the values do for whatever reason, you’ll be happier using the enums.

Plus, I can tell what your code is doing without having to look at what the number reflects, like with keypresses.

I agree with you, but it’s very unlikely he would change an enum. Enums are supposed to stay the same forever and always, or they would just be a variable.