I thought :GetTextSize was made for vertical uses, but its for horizontal uses. I want to get the vertical version of :GetTextSize() for my custom chat system. Like how Robloxs Chat does it, it sizes itself automatically enough for the text to fit with no extra space. I tried switching sides with X and Y but it doesn't work for me.
I need help with this, heres my script:
game.ReplicatedStorage.SendMessageRequest.OnClientEvent:Connect(function(plays, argument) local playerName = plays.Name local textMessage = argument local clone = script.Parent.Template.TextPlayerMessageBox:Clone() local message = playerName .. ": " .. textMessage clone.Content.Text = message local sizeSetRaw = textService:GetTextSize(message, clone.Content.TextSize, clone.Content.Font, clone.Content.AbsoluteSize) print(sizeSetRaw) local sizeSet = UDim2.new(0, clone.Content.Size.X.Offset, 0, sizeSetRaw.X)
Please help
thx
Discussed in Discord, question is resolved.
Issue came down to the fact clone.Content.AbsoluteSize
was limiting the size of the wrapped text to expand. Was changed to Vector2.new(maxWidth, math.huge)
to support infinite scaling in height. (maxWidth being a constant variable of 459 for his total chatbox width)