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

What is the difference between game.Players and game:GetService("Players")?

Asked by 4 years ago
Edited 4 years ago

It's just something I wonder everytime I see people's scripts. Why is 'game:GetService("Players") ' more used than just 'game.Players'? Is It safer or something?

1 answer

Log in to vote
2
Answered by
P100D 590 Moderation Voter
4 years ago
Edited by Ziffixture 4 years ago

Based on this thread from 2016:

:GetService() calls will always return the service, while directly indexing it within game may not. For example, if it hasn't been created yet.

Calling :GetService() is the generally accepted best practice.

Ad

Answer this question