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

Is there a difference between game.Workspace and Workspace.(name of child)?

Asked by
AltNature 169
5 years ago

I was wondering whether or not I could shorten my script a little using this but I'm unsure if there was a difference.

0
There isn't really much of a difference, but game.Workspace is the Workspace Service, while workspace is just a built-in variable assigned to game.Workspace Rare_tendo 3000 — 5y

2 answers

Log in to vote
-2
Answered by 5 years ago

There is not really a difference because workspace is like one of the main tabs (like starter player, server stoarage, etc) the only reason you would use "game" is so that your code will be able to find the workspace. So in conclusion the reason you should add game is because workspace is inside of your game

0
crypt has no idea what he's talking about.If I had enough rep, I'd downvote his answer soutpansa 120 — 5y
0
No, he is right. Workspace is under game. And so are the other services. workspace could mean anything, like it could be a reference to the Players service. User#19524 175 — 5y
0
Ha crypt100 20 — 5y
Ad
Log in to vote
4
Answered by
Mr_Unlucky 1085 Moderation Voter
5 years ago

There is no difference. It's recommended to use workspace however. Other options include:

game.Workspace
game:GetService("Workspace")
0
Where does it say it's recommended to use workspace over game.Workspace or game:GetService("Workspace") User#19524 175 — 5y
1
workspace is recommended because it helps save time typing. Mr_Unlucky 1085 — 5y

Answer this question