Why and when do we use this kind of brackets () {} [] in Roblox studio I don't get how and when they should be used please give me an example of these things I can't figure out how and when to use these.
when do you use these () [] {} brackets in Roblox studio?
2 answers
() are used for parameters like in here:
function()
example:Destroy()
example:Clone()
[] are used for "complicated" explorer paths, like for example: if an item in the explorer has a space in it. You can use [] to gets its path in scripts
local example = game.Workspace["example example"]
(Don't use periods/dots when you are using them)
{} are used for tables and dictionaries Tables are used to store any thing such as: String (text) Numbers Boolean (true/false) Paths (game.Workspace.Example)
They are used like this
local table = {example, 123, true, false, game.Workspace.Example]
Hope it helps.
() brackets could be used to get services and be used to store parameters; {} are mostly used to store values in table or arrays; [] are also used for tables to reference the index or value of the referenced table Hope this helps :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Square Braces are used for indices.
To add, parenthesis are also used for function calls, not just parameters.