I’m writing a
CustomChat and I’ve got far enough to properly adjust the
YOffset length judging if the #
Characters returned are greater than the
AbsoluteSize.X of the
ChatLabel to “drop a line”. Yet as much as I try I cannot seem to determine a proper technique to adjust the ChatLabels to work their way through the
ChatFrame, with different Lengths. The default is 1,-10,0,-25, as a new
ChatMessage is called it will usually just reduce the UDim by 18 pixels. I want to maintain this distance between each TextLabels, yet how would I push up for example default Label Sizes with a 3Line ChatMessage laying in the middle, each has to be differently adjusted to accommodate for the Large TextLabel, primarily I would believe upward more than lower ChatLabels. This is what I’ve got so far.
function CreateChatLabel(ChattedMessage) local ChatLabel = Instance.new("TextLabel") ChatLabel.Parent = ChattedMessages ChatLabel.Text = ChattedMessage ChatLabel.Name = "ChatLabel" ChatLabel.TextSize = 14 ChatLabel.ZIndex = 2 ChatLabel.Font = "ArialBold" ChatLabel.TextXAlignment = "Left" ChatLabel.Size = UDim2.new(1,-10,0,-25) ChatLabel.Position = UDim2.new(0,5,1,18) ChatLabel.BackgroundTransparency = 1 ChatLabel.BorderSizePixel = 0 ChatLabel.TextColor3 = Color3.fromRGB(255,255,255) ChatLabel.TextStrokeTransparency = 0.8 ChatLabel.TextStrokeColor3 = Color3.fromRGB(0,0,0) for _,ChatLabel in ipairs(ChattedMessages:GetChildren()) do local StringAbosoluteSize = Vector2.new(ChatLabel.AbsoluteSize.X, ChatLabel.AbsoluteSize.Y) local StringtoFrame= TestService:GetTextSize(ChattedMessage, 5, "ArialBold", StringAbosoluteSize) if (StringtoFrame > ChatLabel.AbsoluteSize.X) then --// Pseudo code for Conditional Statement ChatLabel.Size = ChatLabel.Size - UDim2.new(0,0,0,-(-25)) end if (#ChattedMessages:GetChildren() > 9) then ChattedMessages:GetChildren():Remove() end end end
I don’t have access to the algorithm I used for the determined push, but it was messy, I will upload it to this question early tomorrow morning, but for now, does anyone have any helpful tips or jumpstarts to get the information I need?
For those who cannot tell, the ChatMessages go from Bottom to Top