How to use PixelsPerStud?

I am creating a part that will be like a board to be fixed to a wall.
Inside it, I will write some text:

I want the board (part) to be horizontally sized automatically according to the size of the text.
For this, I created a SurfaceGui inside this part (plate), and there I inserted a TextLabel:

How do I now know what is the X size of the board based on the text size?
I think SurfaceGui.PixelsPerStud would be the solution.
But the documentation does not explain anything.
Can anyone help me with this?

local surfaceGui --the surface gui
local textLabel --the text label

local x = textLabel.TextBounds.X / surfaceGui.PixelsPerStud

--the x should be the exact size to fit the text
3 Likes

That’s perfect, I didn’t know the TextBounds propertie, thank you very much!