For a while, a lot of our methods concerning user data referenced users by their Player instance. More recently, thanks to @TheGamer101 and @Seranok, our newer methods (e.g. GroupService members & GetFriendsAsync) reference users by their UserId. The benefit of this is that these methods can be used for players who aren’t in-game, while the older methods are restricted to in-game players. As I mentioned in this thread, it’d be great if this could change.
Methods that need to be updated
- MarketplaceService:PlayerOwnsAsset(Player, assetId) → MarketplaceService:UserOwnsAsset(userId, assetId)
- Player:GetRankInGroup(groupId) → GroupService:GetUserRankInGroup(userId, groupId)
- Player.GetRoleInGroup(groupId) → GroupService:GetUserRoleInGroup(userId, groupId)
- Or, if the above data is easy to get at the same time, combine into a single method that returns both
- Player:IsInGroup(groupId) → GroupService:UserIsInGroup(userId, groupId)
- Deprecate GamePassService:PlayerHasPass(Player, assetId)
- Wiki page already encourages PlayerOwnsAsset, but it’s not technically deprecated yet
- BadgeService:UserHasBadge(userId, badgeId)
- Remove requirement that user has to be in-game
Potential need for change:
- Player:IsFriendsWith(userId) → Players:IsUserFriendsWith(userId, userId)
- Can’t really think of why this would be needed when neither user is in-game, but maybe someone else has a use case
Should not change:
- AssetService:CreatePlaceInPlayerInventoryAsync(Player, …)
- Developers shouldn’t be able to spam users’ inventories with places when they’ve never even joined their game