Two text colors on one line?

I’m making a hud and i want the players balance and salary on the same line but in two different colors, is there a way about doing this?

Use two separate DrawText calls, but put one after the other.

Wouldn’t that require me to choose two different positions for the text? I want them to be right next to eachother no matter the value much like they would if they were in the same drawtext call

You can use

surface.GetTextSize to get the width of the first section so you can place the second right after.

Find out the width of the first line (, then find out the width of “blank” space in given font. So X location of second call would be: x = x+1stlinewidth+widthofspacebar (or simply include the spacebar in the second call.)

code, half assed, idk if its gonna work.

local text1 "I am red "
local text2 = " and I am green"

local x,y = surface.GetTextSize( text1 )

Thanks, there were a couple problems but i fixed em