How would I compare a Vector2 with a number?

How would I compare these two values?

if game:GetService("TextService"):GetTextSize(Recipes[ItemName][1], 14, Enum.Font.SourceSansBold, Vector2.new(Frame.LineOne.TextLabel.Size.X, Frame.LineOne.TextLabel.Size.Y)).X > Frame.LineOne.TextLabel.Size.X
Better lining display

image

Basically, :GetTextSize() returns a Vector2 and I’m not too sure how to compare that to a number
Shouldn’t Vector2.X return a number in the first place?

Here’s my output error

attempt to compare UDim and number

If you are in need of documentation here you go
https://developer.roblox.com/en-us/api-reference/function/TextService/GetTextSize

TextLabel.Size.X is Scale and Offset, need to specify which one.

1 Like

The UDim is TextLabel.Size.X, not the return from GetTextSize. Try TextLabel.AbsoluteSize.X instead for the raw number of pixels; the main size property has both Scale and Offset.

2 Likes