I want to add signs into my game and allow a player to input text across 4 lines. However, I am unsure how to effectively save what they have written using a string
self.Coords[x][y][z] = BlockId .. '"Test_More_Lines_Ok"'
-- later on
local NewLine1 = string.find(extraData.String, "_")
local NewLine2 = string.find(string.sub(extraData.String, NewLine1 + 1), "_")
local NewLine3 = string.find(string.sub(extraData.String, NewLine2 + 1), "_")
print("String", NewLine1, NewLine2, NewLine3)
local Line1 = string.sub(extraData.String, 2, NewLine1 - 1)
local Line2 = string.sub(extraData.String, NewLine1 + 1, NewLine2 - 1)
local Line3 = string.sub(extraData.String, NewLine2 + 1, NewLine2 - 1)
local Line4 = string.sub(extraData.String, NewLine3 + 1, NewLine3 - 2)
print(Line1, Line2, Line3, Line4)
NewBlock.PrimaryPart.Sign.SignData["Line1"].Text = Line1
NewBlock.PrimaryPart.Sign.SignData["Line2"].Text = Line2
NewBlock.PrimaryPart.Sign.SignData["Line3"].Text = Line3
NewBlock.PrimaryPart.Sign.SignData["Line4"].Text = Line4
Problem is, what if a player has an underscore as part of their text?? What do I do then? How can I filter this out?
Ideally, I need a way to split the string into â4â segments to represent each line. However, a player might not have anything on a specific line, for example, if they just have text on line 4, itâd look like
self.Coords[x][y][z] = BlockId .. '"___Ok"'
Which just looks bad. SO are there are better solutions??
PLEASE NOTE, I CANNOT SAVE IT AS A TABLE OR ANYTHING LIKE THAT! IT MUST BE SAVED UNDER A STRING! DO NOT SUGGEST ANY OTHER ALTERNATIVE
