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

How do I use [] in a script and not trigger a problem?

I am new to scripting so don't know if this is just dumb. I have a tool in lighting that is [Card] Level 1. I think that [] trigger a problem. Is there no way for me to have this in the script?

local Tool = game.Lighting.[Card] Level 1:Clone()

2 answers

local tool = game.Lighting:FindFirstChild("[Card] Level 1"):Clone()

[] is used for other things within the scripting language so i think the best way to get around it is to make sure its used in a string. blank (space) spaces are also problematic, try using underscores ( _ ) instead!

Hope this helps!

In lua tables mostly. The sqaure brackets []. These are used to index a table. It can be used to get and set the value attached to that table.

Dictionaries are primarily used as an alternative for. When the string contains a whitespace this basically, means a space in a string for e.g. "Hello World of "Scripting is fun"

When using a squared bracket [] you do not need a dot or your script will error

Your script should look something like this

local Tool = game.Lighting [Card] Level1:Clone()

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