Convert string to Enum.Font?

Hey everyone!

Is it possible to take a font name string (e.g “Gotham”) and somehow convert that into a Enum.Font value (e.g Enum.Font.Gotham)?

All help is appreciated. :smiley:


Simple as that.

1 Like

Thanks a bunch!

If you’re doing this to convert a user’s input to a font, you can actually just use the string to set the font. For example, just do TextLabel.Font = "Gotham" and it will work.

@sjr04 beat me to it and actually his is way better.

1 Like

I actually tried this and I got an error. It has worked in the past for me, but for some reason it did not. That’s why I pleaded for help on the DevForum.

Oh, interesting. Yeah normally it should cast it to an Enum but in your case then, the first suggested method will be best.

1 Like