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.
() are used for parameters like in here:
1 | function () |
2 | example:Destroy() |
3 | 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
1 | 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
1 | 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 :)