Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

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

Asked by
Ziffixture 6913 Moderation Voter Community Moderator
5 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)
print(vector2)

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

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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

local VectorFillSize = Vector2.new(ChatLabel.AbsoluteSize.X,ChatLabel.AbsoluteSize.Y)
local ReturnSize = TestService:GetTextSize(ChattedMessage, 5, "ArialBold", VectorFillSize)
print(ReturnSize)
--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!

Ad

Answer this question