How can I return the number of badges someone has?

So I want to make a overhead gui which displays the amount of badges someone has and I’m not sure how to do it. If someone could help me out I’d really appreciate it.

This might be of use to you:

You may not want to use proxies though. See this:

Instead, you could do something like this:

local badges = {} --Your games badge ids go here with commas and stuff
local player = game.Players.LocalPlayer -- You would change this to whatever works with your script.
local badgeserv = game:GetService("BadgeService")
local number = {}

for i,v in badges do
	if badgeserv:UserHasBadgeAsync(player.UserId,v) then
		number[1] = number[1]+1
	end
end

print(number[1])

If you were asking about just all the badges owned in general, I am not sure why you would, because they could just create a game and award themselves a few badges. However, you would probably have to use proxies like @Katrist mentioned.

I’m fairly sure they are talking about every badge they have though, if they just need some specific badges then yea your solution works.

How could i display every badge they own and not a list of badges