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

what is the period ( . ) used for in scripting? [closed]

Asked by 6 years ago

im new to game development and i have seen people using . in their scripts what does it mean?

0
Defining or indexing a value and or key in a data type. EpicMetatableMoment 1444 — 6y
0
what is a key and what is indexing? EzireBlueFlame 14 — 6y
0
WOAH DUDE -49 REP, ONE MORE REP LOSS AND UR BANNED!!!! Here is something you should know: You MUST provide code in all questions, you must be really clear and you mustn't duplicate and spam questions.... greatneil80 2647 — 6y

Closed as Not Constructive by Goulstem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

The period on roblox is used to represent the ancestry between classes and instances on studio. The way ancestry works is that if a an instance such as a part belongs in a type of folder or class (for eg: workspace), the part in which the class it is becomes the parent and the instance is the child of that class. So let us say I put a part in a folder called Bricks in the workspace. Because the part is inside the bricks folder, that folder becomes the parent of the part. This, by default will consider the part the child of the folder since it is inside it. Using the same logic, we can deduce that since the folder is in workspace; the parent of it is the workspace as the folder belongs to the workspace; and the folder becomes the child of workspace.

for example

--Let us break it down.
--Start with the parent.
game.Workspace
--Now insert a part into the workspace,
game.Workspace.Part
--This tells us that workspace is the child of game, and the parent of workspace is game. This also tells us that Part is inside the workspace class and is the child of it; opposing that is the workspace being the parent of the part.

--Now to sum things up, I added a folder in the workspace called bricks; using the same logic we can track down this part with our knowledge.

game.Workspace.bricks

--That is it.
0
You should have incorporated how else " . " can be used, there is plenty other ways like tables, functions, and metamethods EpicMetatableMoment 1444 — 6y
0
There is only one use for the dot operator in general which is indexing. RayCurse 1518 — 6y
0
Well since he is a beginner, let's not go that far into detail for him. MaximumOverdriven 152 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

It separates out things. So this would be what it could be used for.

game.Workspace.Part.Name = "Hello"

What the (.) is doing is splitting the code. Its telling the code that the part that you want to change the name is in the "Game, then the Workspace, PartSelected then the property name and then the name you want it to be.

0
sorta right. A lot wrong User#21908 42 — 6y
0
This period represents the ancestry of the instances in the studio overview. What ancestry is, is basically what decides whether an object belongs to a specific class or service; for example, let us say I have a part it workspace: the part would be considered the child as it belongs to the workspace class and can be defined like this: MaximumOverdriven 152 — 6y