Wrapping a string

Hey. I’ve recently been mucking around with making a chatbox. It’s working as I intend it to, but the only issue I have so far is wrapping a string. I’m trying to get it so that if someone types a long message which is longer than the length of the chat box, then it moves the rest of the message onto the next line.

I searched FP for previous threads and found this. I tried this without specifying the indent and indent1 arguments, but I receive the error:

[lua][Simplistic_Street\Gamemode\Client\Chat.lua:7] attempt to perform arithmetic on local ‘indent1’ (a string value)[/lua]

Could anyone point me to another solution? Thanks in advance.

string.len, surface.GetTextSize (Depending on your implementation) , push the remainder onto the next line. You could also split it into words and check the sizes.