How to use GetTextBoundsParams with a specific TextLabel

I am beyond confused with Fonts and the documentation is very poorly written and beyond confusing to use.

I want to use GetTextBoundsParams

local TextBoundsParams = Instance.new("GetTextBoundsParams")
TextBoundsParams.Text = NewKeybind.Info.Label.ContentText
TextBoundsParams.Font = NewKeybind.Info.Label.Font
TextBoundsParams.Size = NewKeybind.Info.AbsoluteSize.Y
TextBoundsParams.Width = math.huge

specifically this

TextBoundsParams.Font = NewKeybind.Info.Label.Font

Unable to assign property Font. Font expected, got EnumItem

Font expected, I gave it Font…

Can you show what code for the font looks like?

In the documentation it’s supposed to look like this

Or like this

local params = Instance.new("GetTextBoundsParams");
-- Method 1
params.Font = Font.fromEnum(Enum.Font.Arial);
-- Method 2
params.Font = Font.fromName("Arial"); 
-- Method 3
params.Font = Font.fromId(8836875837); -- Get the asset ID for this one

So there are 4 ways to assign font’s to the instance.

Here is the list of predefined and usable fonts:

2 Likes