Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Chat message text question?

So I've created my own chat, and i'm currently using textbounds to position the messages to the right of the sender text.

However, I do not find this efficient because i'd have to limit the message by a lot of characters.

I'm wondering if its possible to calculate the amount of spaces needed before the message text and use it that way.

Example:

Sender will be player1. Sender's message will be hello.

I want to know how it would be possible to make the message like this:

"         hello"

the spaces at the left of 'hello' are the spaces which would allow room for the sender's text. It should like this:

player1: hello.

Any possible way to do this? Thanks

2 comments

0

The biggest problem with doing it that way is that most fonts are not monospaced, meaning different characters have different widths (eg: ' w ' and ' i '). Offsetting the text is probably the most accurate way to go, as this way you wont have to worry about character widths of the font you are using.

0

I'll only be using SourceSansBold, can i get an example for that font?

1 answer

Edited the answer. Now when I believe I understand your question, my answer is this:

http://wiki.roblox.com/index.php?title=API:Class/GuiBase2d/AbsoluteSize

You could use that.

messageGui = nil
playernameGui = nil

messageGui.Position = playernameGui.Position + UDim2.new(0,tostring(playernameGui.AbsoluteSize):sub(1,tostring(playernameGui.AbsoluteSize):find", "-1))

2 comments

0

how illiterate can you be

0

You know, you can post that to someone whom haven't understood your question and complains. But not to someone who accidently misunderstood it and trying to help. Not only did you -rep me, but you also insulted me. Smh.

This discussion is preserved as it was. New answers, comments, and votes are closed.