local MessageFrame = Instance.new('Frame')
MessageFrame.AnchorPoint = Vector2.new(0.5, 1)
MessageFrame.BackgroundTransparency = 1
MessageFrame.Position = UDim2.new(0.5, 0, 1, 0)
MessageFrame.Size = UDim2.new(0.9, 0, 0.1, 0)
local PlayerLabel = Instance.new('TextLabel')
PlayerLabel.AnchorPoint = Vector2.new(0.5, 0.5)
PlayerLabel.BackgroundTransparency = 1
PlayerLabel.Position = UDim2.new(0, 0, 0.5, 0)
PlayerLabel.Font = Enum.Font.GothamSemibold
PlayerLabel.Text = tostring(speaker)
PlayerLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
PlayerLabel.TextSize = 16
PlayerLabel.TextXAlignment = Enum.TextXAlignment.Left
PlayerLabel.TextYAlignment = Enum.TextYAlignment.Top
local Message = Instance.new('TextLabel')
Message.AnchorPoint = Vector2.new(0.5, 0.5)
Message.BackgroundTransparency = 1
Message.Position = UDim2.new(0.5, 0, 0.5, 0)
Message.Size = UDim2.new(0.95, 0, 0.9, 0)
Message.Font = Enum.Font.GothamSemibold
Message.Text = message
Message.TextColor3 = Color3.fromRGB(255, 255, 255)
Message.TextSize = 18
Message.TextXAlignment = Enum.TextXAlignment.Left
Message.TextYAlignment = Enum.TextYAlignment.Top
local function measureSize(textObject)
return game:GetService('TextService'):GetTextSize(textObject.Text, textObject.TextSize, textObject.Font, Vector2.new(textObject.AbsoluteSize.X, 10000))
end
PlayerLabel.Size = UDim2.new(0, PlayerLabel.TextBounds.X, 0, 18)
Message.Text = ("%s%s"):format(string.rep(" ", math.ceil(measureSize(PlayerLabel).X / game:GetService('TextService'):GetTextSize(" ", PlayerLabel.TextSize, PlayerLabel.Font, Vector2.new(5000, 5000)).X) + 1), message)
MessageFrame.Size = UDim2.new(0.95, 0, 0, measureSize(Message).Y)
This is what I got currently,
Doesn’t alter frame size still, and since I’ve now made the username a seperate label, it creates a large gap between the username and the message, as well as the message looking bigger than the username even tho they are the same size/font