|
| 25 May 2016 08:34 PM |
I am making a chat gui and everything is set up but I have a problem. If the chat message is to long, the text will get cut off.
Example: hi my name is ice from space and i love roblox you would only be able to see hi my name is ice from space and i
now I can not use string.len to check the length of the string because every letter is a different width and everyones name is longer or shorter so the amount of letters in there message wouldn't matter.
i can't use string.sub because i don't know where to let the script know to cut the sentence [dont want it to cut mid word]
someone please help, please don't just leave a wiki article I've been trying for 2 days now. join this game for a visual: https://www.roblox.com/games/417972868/skrupt-testung |
|
|
| Report Abuse |
|
|
doctor152
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 308 |
|
|
| 25 May 2016 08:39 PM |
I suggest looking into "TextFits", a property of TextBoxes and TextLabels.
For example, if the TextBox is overflowing then using "TextBox.TextFits" will return false and vice versa.
|
|
|
| Report Abuse |
|
|
|
| 25 May 2016 08:41 PM |
| You can make the text fit the scale and you can make the box multi lines. |
|
|
| Report Abuse |
|
|
|
| 25 May 2016 08:42 PM |
Ok so I would add
if textbox.TextFits == false then -- make a new line splitting the text in half, and if the text is to long on the second line, do it again, etc. end
I wouldn't know how to tell the script where to cut the text. |
|
|
| Report Abuse |
|
|
doctor152
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 308 |
|
|
| 25 May 2016 08:43 PM |
I suppose you could have a loop to continuously reduce the text length until it does fit?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 25 May 2016 08:47 PM |
| i want the text size to be the same. |
|
|
| Report Abuse |
|
|
|
| 25 May 2016 08:48 PM |
| TextBox.TextWrapped = true |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 May 2016 08:49 PM |
"I suppose you could have a loop to continuously reduce the text length until it does fit?"
Im so frustrated right now because no one is understanding me.
Think of the regular rob lox chat notice how when ur text gets to long, rob lox breaks it into a new line underneath ur name? THATS exactly what i want to do.
|
|
|
| Report Abuse |
|
|
|
| 25 May 2016 08:51 PM |
No NO NO!! What aren't u guys understanding!
TextScaled changes the text size, I DO NOT want to change the size
TextWrapped, that could work except, I want the script to create a separate line underneath the name to. Not just squeeze the text into one box.
|
|
|
| Report Abuse |
|
|
|
| 25 May 2016 08:51 PM |
If u guys would join this place I could explain it a lot better.
https://www.roblox.com/games/417972868/skrupt-testung |
|
|
| Report Abuse |
|
|
doctor152
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 308 |
|
|
| 25 May 2016 08:52 PM |
Ignore TextScaled, textwrapped however could prove useful. If you are determined to create an entirely new line then you can do what I said previously.
|
|
|
| Report Abuse |
|
|
|
| 25 May 2016 08:52 PM |
roblox.wiki.com solves it all google roblox wiki custom chat it teaches you thats how i made mine btw |
|
|
| Report Abuse |
|
|
|
| 25 May 2016 08:57 PM |
http://wiki.roblox.com/index.php?title=Making_a_Pseudo_chat_GUI http://wiki.roblox.com/index.php?title=Custom_chat_GUI http://wiki.roblox.com/index.php?title=Chat_commands Please also thumbs up my game if this helped! https://www.roblox.com/games/346407590/Distance-Alpha |
|
|
| Report Abuse |
|
|
|
| 25 May 2016 09:08 PM |
| None of those had what I needed :/ |
|
|
| Report Abuse |
|
|
|
| 25 May 2016 09:12 PM |
ok, here's how I do:
i have a table storing each letter's length and i simply calculate the length of each line |
|
|
| Report Abuse |
|
|
WoolHat
|
  |
| Joined: 19 May 2013 |
| Total Posts: 1873 |
|
|
| 25 May 2016 09:24 PM |
This method sounds shoddy, but it works for my purposes. Certainly better than a table of every letter's dimensions, lol.
What I do is I set the TextWrapped property to true, and make the vertical height very large (What this does is align the text to fit in the box fully from the first word to the last word). Then I change the TextLabel's Y offset to the Y of its TextBounds. Easy as that.
The problem you will likely encounter is the positioning of the gui after you place it. |
|
|
| Report Abuse |
|
|
|
| 25 May 2016 09:37 PM |
| Ohhhh I know what you mean, I'm having the same problem with my custom chat gui, what. I would do is use string.len and try to find the fasttest letter or number and then right when it's about to get cut off just subtract the string.len by like 1-3 just to be sure and then cut it off to a new line |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 May 2016 04:35 PM |
| So sorry the only way I can think of is use a diff script (msg me 4 it) but I need that 1,500 R$ btw got to follow me to msg me |
|
|
| Report Abuse |
|
|
| |
|