Fetch badge data of multiple badges at once (BadgeService:UserHasBadgesAsync)

The Ask

UserHasBadgesAsync would have almost identical functionality to UserHasBadgeAsync, however it would take an array of badgeIds instead of a single badgeId.

It would return relevant information (likely as a table or possibly two tables) on what badges a user does and does not own.

The Reason

I have several experiences with large quantities of badges used as achievements.

Users often wish to achieve all badges in an experience. Thus, users need to see their progress. The only way this is currently possible is via the website or an in-game UI. The most engaging way is within the experience. This would encourage players to stay in an experience for longer to complete all it has to offer.

Given that info, it makes sense to display a user’s badge progress from within the experience. Currently, getting a user’s badge progress is cumbersome, non-intuitive, and it has a heap of technical issues.

User Story

With the current BadgeService APIs, I am unable to easily process if a user owns multiple badges.

  • The current method is to get badge ownership status one at a time and save it to a DataStore for future calls. This method still has throttle issues at medium/large scales and creates a clunky experience. Forcing a user to wait for a UI or to get their badge progress is silly. This is neither scalable nor intuitive.

  • Large Roblox events (such as Metaverse Champions) have this exact use case already - if there is to be more events like it in the future (or if developers wish to make similar events), this use case should be simplified.

Cherry On Top

Create this API alongside BadgeService:GetBadgesInfoAsync.

One call with the ability to get info without supplying EVERY badge ID is super useful. This solution (GetBadgesInfoAsync) is much more dynamic, simple, and useful than any alternatives.

It would allow developers to easily grab all info about an experience’s badges and check if a user owns them. Many lines of code, with annoying error checking loops, with a manually written badgeId array would boil down into two simple methods with proper pcall usage.

39 Likes

You should title this post after a problem rather than a proposed solution (e.g. not as an API suggestion).

e.g. “Fetch badge data of multiple badges at once”

This makes it easier for other (less experienced/technically proficient) developers to read and understand the title, find your topic via search, and support/reply to it in the future. Can still include the API suggestion in the body.

12 Likes

Hello I am having the same problem today cause Im trying to get the data of players to check how many badges they own and if they own 10/15 it shows them on a ui as well as it updates in game now I don’t know what to do cause of the Badge Service API I was wondering if you found a solution to this?

The best interim solution is to store badge ownership/progress in a DataStore.

You will still hit throttling limits if you query a lot of badges in one go, but you will gradually get less over time with repeat players if you set up your data properly (load/store the data in a server array, change the array after a player earns a badge or you query it, then save the data when a user leaves + at regular intervals).

1 Like

me want this too

not that it’s super necessary but for my niche creation it would be pretty convenient!

i made a sword that can apply different effects based on what badges a player has so i have to iterate through all badges they have pertaining to the specific item
but this allows anyone who owns the sword to use these effects in any game they decide to put the sword in

later on i may need to outsource to using httprequests to figure out that information but that’s a lot less reliable and less efficient for something that anyone can throw into their game

so if roblox decided to ever so kindly add this feature that’d be epic <:
(yeah im probably the only person who would need this but maybe others will utilize it too v.v)

1 Like

As of release 615, this is now a thing with CheckUserBadgesAsync. Neat. Name is slightly irking that it doesn’t match UserHasBadgeAsync but yolo.

5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.