Broken game pass script

I’m trying to make a button where if you own a certain game pass, it brings up a GUI on click. If you don’t own that certain game pass, then it’ll bring up a different GUI.

My issue is that even though I own the certain game pass, the wrong GUI shows up. The GUI that shows up is the one that should only show up when you don’t have the pass.

I’ve tried using the MarketPlaceService and GamepassService, as well as stating certain lines in different ways.

I’m out of ideas to fix this

You have to use Marketplace Service and instead of player has pass use this. MarketplaceService:UserOwnsGamePassAsync

1 Like

Alright, so I edited the script. It now looks like this:


I just ran a test of the game, and it still isn’t working. Is there anything else I could try?

Is there any output, or errors in the console?

When I click the button, the output says this

  1. Are you testing this in Studio or Roblox Player?
  2. Try printing after UserOwnsGamePass it may not be the issue.

You should do this:

game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, id)

You need to do UserId, because the player itself is not a int64 value.

1 Like

Next time you should check the Roblox Developer site before going to the Dev Forum. MarketplaceService | Documentation - Roblox Creator Hub