Log in to vote

Maintaining an equivalent distance UDim between differently Sized GUIObjects #2?

Asked by
Ziffixture 6785 Moderation Voter Community Moderator
2 years ago

Hello again, thanks to a great suggestion on my recent issues, I'm now trying to configure everything to work with this method, at the moment I'm trying to use TextService to get going, and one thing I'm trying to print for validation is TextService:GetTextSize(), I believe I've formatted the required parameters correctly, if not please let me know. This is what I have

local VectorFillSize = ChatLabel.AbsoluteSize.X, ChatLabel.AbsoluteSize.Y
local vector2 = TestService:GetTextSize(ChattedMessage, 5, "ArialBold", VectorFillSize)

Console replies Unable to cast double to Vector2 Please help me out!

1 answer

Log in to vote
Answered by 2 years ago
Edited 2 years ago

You need to create a Vector2 value from your ChatLabel's AbsoluteSize.

local VectorFillSize =,ChatLabel.AbsoluteSize.Y)
local ReturnSize = TestService:GetTextSize(ChattedMessage, 5, "ArialBold", VectorFillSize)
--i wouldnt name your variable vector2, as it may cause confusion between the actual Vector2 variable. just remember that :GetTextSize() returns a Vector2, so thats what ReturnSize is

See how the frameSize argument is a Vector2 value on this page.

Accept and upvote if this helps!


Answer this question