How to create a font selector?

I am creating an interface where the player can create a banner for his office.
I wish the player could choose the font to be used.
How to do this via script?

1 Like

Hey rogeriodec_games!

To select a font, you could do something similar as below:

local fonts = {
	Enum.Font.Arial,
	Enum.Font.Gotham
	--build a table of allowed fonts
}
for i,v in pairs(fonts) do
	local font = tostring(v)
	font = string.split(font,".")[3]
	print(font) --prints "Arial" or "Gotham" (In string form so you could use it for a text label)
	--from here you can make the code to create a gui list of fonts for instance or something else
end```
1 Like

Do I have to declare all fonts one by one?
Is there a way to get all available fonts?

Hey rogeriodec_games!

Unfortunately, to my knowledge there is no way to get all possible fonts. If you reference the Enum Types you can find a list of all the fonts. I will link it below:

EnumIndex.Enum.Font

Yeah, and now we have new fonts:

However, they are not listed yet:
https://developer.roblox.com/en-us/api-reference/enum/Font

Theres also some that don’t appear there … image

Hey rogeriodec_games!

That is a topic for ROBLOX to fill out because that is outdated API-Documentation. As for now, you can manually list them off yourself or look for another solution.

Hope this helps!

Hey rogeriodec_games!

I was looking around and found this useful array:

Enum.Font:GetEnumItems() --returns table of fonts

This should help you get a table of the Font Enums. I overlooked this, sorry!

2 Likes

Already did: