I have been getting the workspace by typing “game.workspace” for quite long ago, then I realized you can just type in “workspace” instead so I then started using it.
I’m just wondering: what’s the most optimized way / best way there to get the Workspace?
Is there something wrong with getting the Workspace by:
--or (I don't even use this one)
I always thought typing “workspace” was a good practice since it’s more compact and also less text means cleaner code, but is it really the best option there?
Please, let me know what you think down below. Thanks for your help.
I’ve ran a performance test in Studio on
workspace, there’s little to no performance difference between
game:GetService('Workspace') runs pretty much at the same speed as
there’s no point in this;
indexing workspace is just as simple as doing game.Workspace or workspace simply, it’s loaded implicitly almost as immediately as a player joins, it won’t affect performance (or at least not significantly enough)
When I began scripting, I used tutorials, some people used
workspace, some people used
game.Workspace. I thought
game.Workspace was more advanced, but turns out no difference!
It says here the difference between workspace, game.Workspace and game:GetService(“Workspace”).
Thanks for all your feedback!
I will just stick to use
workspace to keep my code smaller.
I never knew you could use “workspace” instead of game.Workspace or game:GetService(“Workspace”)
I’ve only saw it in 1 script, but thought it was a mistake
Well, thanks for the info