Unable to cast Font to token [Inter]

So I’m making a custom TextBox right, and I’m at the stage where I have to make the custom cursor appear, tho I need to get the textsize with the TextService:GetTextSize

1. local UserFont: Font = Font.fromId(12187365364, Enum.FontWeight.Medium, Enum.FontStyle.Normal)
2. local function OnTextBoxTextChanged()
3.	local TextSize: Vector2 = TextService:GetTextSize(string.sub(TextInput.Text, 1, TextInput.CursorPosition), TextInput.TextSize, UserFont, Vector2.new(0, math.huge))
4.	Cursor.Position = UDim2.new(
5.		0, TextInput.Position.X.Offset + (TextInput.Size.X.Offset / 2) + (TextSize.X / 2) + 2, 0,
6.		TextInput.Position.Y.Offset + (TextInput.Size.Y.Offset / 2) - TextInput.TextSize / 2
7.	)
8. end

But I’ve been searching the entire forum to find a solution, which I did not
I get this error on line 3:
image

Font: https://create.roblox.com/store/asset/12187365364/Inter?viewFromStudio=true&keyword=inter&searchId=07138584-d3c7-4ca2-b81c-a82039fc6079

It’s mybad, I was using the wrong thing.

local Params = Instance.new("GetTextBoundsParams")
Params.Font = UserFont
Params.Text= Text
Params.Size = TextSize
Params.Width = MaxWidth

Bounds = TextService:GetTextBoundsAsync(Params)

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