I’m working on a custom chat UI and I’m using richtext so players will be able to customize the colors in their name and stuff like that as well is give titles before names [New]PlayerName: Message
something like that. Anyways it all works fine and dandy for the most part, but for some reason when I’m inserting a new message into the frame i’m using as a textbox (there’s a UIListLayout inside the frame which makes the textlabels I put inside it stack on eachother very neat like) the message part appears below the title/name part… which is very odd because when I manually put the examplemessage inside the textbox frame it doesn’t do this. I’ve tried turning off textwrapped as well and it STILL would appear on another line. Also this textlabel is literally the width of the screen so there’s 0 chance it’s reaching the end of the line. I tried centering the text to the middle of the textlabel too and it would still have the message part of the text appear below their name/title. Mostly looking for ideas here, but I’ll include some code to give you a better understanding of what I’m doing but I don’t think this is a code issue but idk.
--Create playerstats
game.Players.PlayerAdded:Connect(function(Player)
local folder = Instance.new("Folder")
folder.Name = "PlayerStats"
folder.Parent = Player
local title = Instance.new("StringValue")
title.Name = "Title"
title.Value = '<font color="#FFD700">[New]</font>'
title.Parent = folder
local name = Instance.new("StringValue")
name.Name = "RichName"
name.Value = '<font color="#00FF00">'..Player.Name..'</font>'
name.Parent = folder
local message = Instance.new("StringValue")
message.Name = "Message"
message.Value = '<font color="#FFFFFF">'
message.Parent = folder
end)
--This is the function that sends the message to the clients
ChatEvent.OnServerEvent:Connect(function(Player, Text)
if typeof(Text) ~= "string" then return end--Check they actually sent a string
if #Text > MaxChatLength then return end--Check that their chat is appropriate length
local TextObject = getTextObject(Text, Player.UserId)
local FilteredMessage = getFilteredMessage(TextObject)
local pStats = Player.PlayerStats
local finalText = pStats.Title.Value..pStats.RichName.Value..pStats.Message.Value..FilteredMessage.."</font>"
ChatEvent:FireAllClients(Player.Name, finalText)
end)
--This is the part of the local script that creates the textlabel
ChatEvent.OnClientEvent:Connect(function(Name, Message)
local newChat = ExampleChat:Clone()
newChat.Parent = Chatbox
newChat.Text = Message
end)
