Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

when do you use these () [] {} brackets in Roblox studio?

Asked by 3 years ago

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.

2 answers

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

() 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.

0
Square Braces are used for indices. Ziffixture 6913 — 3y
0
To add, parenthesis are also used for function calls, not just parameters. R_alatch 394 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

() 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 :)

Answer this question