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

When I try to put ( in a string it says it wants to be completed with a )?

In my code I have a “(” but it’s expecting it to be finished with another ) so “()” but I only want the one (. How do I do that? Same thing with square brackets, and other Magic Characters. I'm replacing the ( with the () in a gsub

script.Parent.TextLabel.Text = string.gsub(script.Parent.TextLabel.Text, "(", "()")

1 answer

✓ Accepted answer

( is a magic character used for string capturing, if you want to use it as normal character you need to prefix it with %:

script.Parent.TextLabel.Text = string.gsub(script.Parent.TextLabel.Text, "%(", "()")

2 comments

0

Yeah I know it was a magic character just didn't know how to use it in a string. Thanks.

0

i said that it's magic character used for string capturing just so if you ever want to learn about it you know what to search for :wink:

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