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

What is the difference between :GetPlayers() and players:GetChildren()?

Asked by
0hsa 193
3 years ago
Edited 3 years ago

recently saw a question containing something like this.

from what i've tested, they return the same thing?

1
'GetPlayers' is a more appropriate method. That and the method will strictly filter Player Instances. Ziffixture 6913 — 3y
0
Nice 0hsa 193 — 3y

2 answers

Log in to vote
2
Answered by 3 years ago

The GetChildren() function is inherited by all instances, this includes objects such as Players, ReplicatedStorage, Lighting etc. And most objects you wouldn't normally think of as instances.

GetPlayers() on the other hand is only inherited by the Players object. I believe they've kept this function for backwards-compatability.

Ad
Log in to vote
0
Answered by
To0_ny 141
3 years ago

maybe read this, it might help.

https://developer.roblox.com/en-us/api-reference/function/Players/GetPlayers

Answer this question