Simply cant use Open-Brackets ("[") on a string

well as the tittle says, i cant use a Open-Bracket in String, but i really need it.
image
the question is, it has a way to get the expected result?

Ah and yea, a Close-Bracket is possible to use. (as the underline shows)

1 Like

Try making β€œ[” another variable, something like this (and run the code and see if it works)

local openBracket = "["
local startBracket = string.find(Dsc, openBracket)
local endBracket = string.find(Dsc, "]")
2 Likes

hmm got it, it worked but now i have anoother problem :sweat_smile:
but i can solve it alone, thanks!

2 Likes

The reason it isn’t letting you do it is because [ is treated as a special character.

The way to put the special character into the string without the error occuring is the put an escape character (which is typically a backslash, however Roblox uses % for this) before the character.

i.e.

string.find(Dsc, "%[")

Using a seperate variable, as the other person suggested, does work but it’s just a bit clunky and unneccessary.

6 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.