How do I go about: Checking if the user has a badge and/or gamepass


I am currently wondering how do you run a function by checking if a player has a gamepass and/or badge. Meaning the code will run once if the user has a badge and/or gamepass. If you want a TL; DR, just skip the context part.

Disclaimer: As of writing this I am at school, on the lunch period, so I don’t have access to my computer and I am not always available.


I am currently making a FNAF fan game (not important). Just to get context, in FNAF game you usually have an office.

So basically, the FNAF office, yes it has a desk.

My game isn’t public yet and not finished, one day I’ll make it public temporarily for testing purposes and give a badge to those who tested it. I also have a donation gamepass.
As of right now, if you own the gamepass, objects appear in your office, these are themed after the FNAF character the purple guy. (run by cloning from ServerStorage to workspace):

  • A little staue of him is on your desk.
  • A little poster of the character is on your wall.
  • A letter appears on your desk, opening it will briefly say thanks for donating. (More info as you read more)


Now that I have a gamepass and badge. I want to know how to do something a bit like this:

GamePassOwned = true
BadgeOwned = true

--Imagine it’s a code that checks for ownership of the badge and gamepass

if GamePassOwned or BadgeOwned == true then

--code here



So basically I want to know how to check ownership of a badge and gamepass and set variables to true.
How do I go about this.

I’ve tried looking up on the forum and dev hub, but it only gives me (for example the gamepass):

--Identifying MarketPlaceService and the gamepass ID.

--I do not fully remember the code (I’m at school as of writing this).

(A function of when the gamepass is owned)
--Code run by it

So if there’s any way to know how I can do this, please let me know.
If there’s any lack of details or confusion, please tell me.

Like I said before, as of writing, I am at school and we’re in the lunch period


For Gamepass checking, you can use MarketplaceService:UserOwnsGamePassAsync(), which expects the Player’s UserId and a gamepass id to check

For badge checking, you can use BadgeService:UserOwnsBadgeAsync() which also expects the Player’s Userid and a badge id to check.

Both of these return a boolean (true or false) that is true if they own the GamePass/Badge or false if they don’tt

They’re self explanatory to use, you just need a Player userid and a gamepass/badge id to check