Font.fromId() Not Working with rbxassetid:// in Roblox Studio

Reproduction Steps

  1. Open Roblox Studio.
  2. Create a new Baseplate.
  3. Insert a ScreenGui on the StarterGui class.
  4. Inside the ScreenGui, add a TextLabel.
  5. Underneath the TextLabel, insert a LocalScript with the following code:
local TextLabel = script.Parent
local TextID = "rbxassetid://12187363887"
TextLabel.FontFace = Font.fromId(TextID, Enum.FontWeight.Heavy, Enum.FontStyle.Normal)
print(TextLabel.FontFace.Family)

Alternatively, you can directly set the font using the code below:

TextLabel.FontFace = Font.fromId("rbxassetid://12187363887", Enum.FontWeight.Heavy, Enum.FontStyle.Normal)
  1. Play the game and observe the output.

Expected Behavior

The Font.fromId() function should successfully retrieve the font specified by the “rbxassetid://” URL and set it as the font for the TextLabel. The output in the console should display the family name of the font.

Actual Behavior

The Font.fromId() function fails to retrieve the font when using the “rbxassetid://” format. The TextLabel retains its default font instead. The output in the console displays invalid argument #1 to 'fromId' (number expected, got string).

Additional Information

This bug occurs consistently when attempting to use the “rbxassetid://” format with the Font.fromId() function. The issue persists even when using valid asset IDs and attempting to retrieve fonts distributed through Roblox Studio’s Toolbox.

Issue Area: Studio
Issue Type: Display
Impact: Moderate
Frequency: Constantly
Date First Experienced: 2023-06-06 19:08:00 (UTC-3)
Date Last Experienced: 2023-07-09 01:45:00 (UTC-3)

1 Like

This is intentional, it only accepts a number for assetId, read the docs.

4 Likes

Im not sure but you migh have to put just the id. it has sense, no?

1 Like

So it does not accept as a string… I never knew that! Well, either way, thank you for sharing this information. :pray:t2:

I am going to possibly create a FR topic for this soon as I feel like as developers, we should have both methods applied.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.