How Do I Check Whenever A User Get A Badge?
So I Had Tried:
BadgeService:Get Whenever A User Get A Badge(Player)
BadgeService:Remove()
BadgeService:Get()
None Of These Work.
Example
It Show Whenever The Player, User Had Got The Badge.
I Have Researched For 8 Minutes.
I Really Want To Check Please Help.
1 Like
Please do some research first before making a post. You can check out this link.
1 Like
I Did Do Some Research Before Making A Post – Topic. And I Don’t Find Any Helpful Things.
You should consider researching various Roblox websites that can help you to resolve your problem. Hope my post helps.
I Already Researching Roblox Website Before. Pls Help Me Check Whenever USer Got Badge.
I’m not going to repeat myself again. I have already provided you the answer you need in the link above. You can check whether a player owns a badge using the function provided by the Roblox API.
To clarify:
Are you wanting to check:
- When the user receives any badge in your game, or
- are you wanting to see if a user currently has a specific badge?
I Want To Check Whenever User Got A Badge.
In order to do that, you would need to have some code placed in all places where you are giving the user the badge, as there is no native way to do it (I think).
I would recommend that you utilise a BindableEvent, which is fired any time you fire the award badge function (so add a couple of lines of code near the award badge thing, to fire the event), then you can listen to that event from another location and do what you want from there
Roblox Should Make BadgeService.OnAward Or BadgeService.Awarded Like How MarketPlaceService Handle Spend Robux.
I don’t really find it necessary for a separate API like this since you’re going to be awarded the badge directly (and only once). The reason for needing the different Marketplace API’s is to determine whether or not the item was purchased is because there is no other way of telling.
Is there a specific goal you were wanting to achieve though?
There A Code For MarketPlaceService That Tell When A User SPend Robux And It Doesn’t Tell Which Only Robux Spend. And It Real Currency Spending. And LogService That Print Error. So BadgeService Should Make One So It Can Be Easyer For Systems And Stuffs.
Awarding the badge will always yield true (unless the player already owns the badge)
Prompting a marketplace gui, however, may not if the purchase does not go through
I think I understand what you are trying to achieve. Are you trying to check if there is an event that gets fired whenever a player from any Roblox servers of your game gets a badge?
If that’s the case, then you need to pair BadgeService:UserOwnsBadgeAsync() with MessagingService.
if badgeservice document didn’t help, maybe this code can
function userhasbadge(userid,badgeid)
local success, result = pcall(function() -- pcall means protected call. it runs code without showing errors. even if the code has one.
return game:GetService("BadgeService"):UserHasBadgeAsync(userid, badgeid)-- this is what gets the badge.
end)
return success and result or nil-- returns result ONLY if sucess is true
end
No. A Event Get Fired When A User Got A Badge. Idk. Like I Wanna Send A Message To Server That Says A User Earned Badge.
Not much point though, as the badges are only awarded when a server script tells them to (at which point, why have an extra API available for a niche use case)
(The second half of my prior message tells you how to achieve what you are after)
Nope. I Was Meaning When User Got A Badge.
When you’re awarding the user the badge, just fire an event to the server to display the message
1 Like