Hello, so I’ve been working on a custom chat gui for quite a while before I stumbled onto a problem where I was not able to calculate the spaces between the textbutton (username) and the textlabel (message)
I’m calculating the spaces between both of them because if the player sends a message, the textbutton and textlabel will both touch each other and ruin the gui design.
This is how it looks if i don’t calculate the spaces between them:
Please any feedback would be appreciated on how to fix this issue!
see how the username and message are both spaced, that is what I’m trying to archieve. I’m trying to caculate the spaces between the textbutton and textlabel in mine so that they don’t touch each other
I believe you can use string.len()
. See how long the name is and add a space for each letter in the chat text.
“The_Finished:” = 13
Add 13 spaces - “eee…”
string info
Here’s an example:
local Name = "The_Finished:"
local Chat = "eeeeeeeeeeeeeee"
--local space = " " [You could use a variable if you wanted to]
print(string.rep(" ", string.len(Name) + 1),Chat) -- This will add a " " (Space) for the length of the username. +# to add space between the username and chat (Currently +1)
This is the current method Roblox uses for their default chat. Meaning, adding spaces before the chat
1 Like
Another method you could use is placing both the Name & Chat inside of something like a Frame, and add a UIListLayout
.
1 Like
oh yeah i forgot about that, thanks man, i’ve been stuck on this issue for an hour
1 Like