Hey! Sorry if this is the wrong category to post this in. But I wanted to know if it’s possible to get a table of all the badges a player has ever received, if so any help would be appreciated!
why would you want this? sounds difficult
There’s no direct way to get all badges a player has ever earned across the entire platform through Roblox’s API in-game. BadgeService only lets you check if a player has specific badges that you already know the IDs for.
If you really need this you’d have to use the Roblox web API outside of the game. There’s this endpoint https://badges.roblox.com/v1/users/{userId}/badges that returns all badges for a user, but you can’t call that directly from a game script because of CORS and stuff. You could set up a proxy server or use something like HttpService with your own backend to fetch that data.
Similar to what @Collafranca said, there is no way to really get a list of badges a player has every received without using stuff like web APIs. If its for badges in your own game, you could do something like this:
BadgeService = game:GetService("BadgeService")
badgeTable = {put a list of badgeIds here}
local function returnAllOwnedBadges(player:Player) -- call this somewhere in your code
ownedBadges = {} -- empty table that the function will fill
for i, badgeID in badgeTable do
if BadgeService:UserHasBadgeAsync(player.UserId,badgeID) then table.insert(ownedBadges,badgeID) end
end
return ownedBadges
end
There also is CheckUserBadgesAsync although it has a max of 10 badges it can return, so it could be better to check each individually.