Difference between GetService and just appointing a path

I’ve start scripting two weeks ago, and I always used this code to make a path to an object:

game.Workspace.Folder.randomStuff

But today, I found some scripts that looks like that:

game:GetService("Workspace").Folder.randomStuff

What are the difference between that two ways to point a path?

1 Like

This is the sort of thing that you should search instead of ask. It’s been asked quite a bit and there are some really good answers by some really smart people. And then you also wouldn’t have to wait for a reply.

It can be a good practice for future proofing, since renamed services can still be obtained this way. Mostly though, it’s used to initialize services such as Teams which aren’t always initialized when the game starts.

1 Like