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

Is there an advantage for using GetService?

Asked by 4 years ago

Is there any advantage to either game:GetService("Players") or game.Players?

1
if you rename the Players service, you can still use game:GetService("Players"), but not game.Players theking48989987 2147 — 4y
0
nice, did not know that Gameplayer365247v2 1055 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

There is a difference. First of all game.Players runs exactly the same as game:GetService("Players") But..

Lets say that someone has a trash PC, if your using game.Players then there is a possibility that the service has not loaded in yet thus will result in an error destroying your whole script.

But game:GetService("Players") if the service has not loaded in yet then the script will add the service to your game so no matter how trash the players PC is, it will always load in properly with no errors. I hope this helped and solved your problem.

Happy Coding, Destroyer1234x

Ad

Answer this question