MarketPlaceServ:UserOwnsGamePassAsync never returns true?

The issue that I am currently having is that :UserOwnsGamePassAsync is never returning true. This is my first time using the MarketPlaceService so I could be doing something very obvious wrong, but I have been trying to figure this out for quite a bit now and it still isn’t working.

local hasColors = false

	local success, message = pcall(function()
		hasColors = marketPlaceServ:UserOwnsGamePassAsync(Player.UserId, colorsID)
	if hasColors then -- Has Colors never has returned true unless I created the pass
		colorsFrame.Visible = true
		enterColors.Visible = false
		script.Parent.lockerFrame.Visible = false
		viewCards.Visible = false
	elseif hasColors == false then
		print(hasColors) -- Just used to see what the Value is in hasColors
		marketPlaceServ:PromptGamePassPurchase(Player, colorsID)

This is the code I am using to determine if the player owns the game pass or not. As you can see all I simply want it to do is if the player clicks on a button, if they don’t own the gamepass it will prompt them to purchase it. But instead of the player being able to access the new section it keeps prompting them? Somebody please help, Thanks In advance.

what does it prints in Has colors

99% of the time it is false, it really has never returned true unless I use it on the account I created the gamepass on.

Do you bought it on Test accounts?

Also note that it always returns a value so you should change

if hasColors then TO if hasColors == true then

Yes, I even made sure to try and relog and wait significant amounts of time, just to see if it was taking a while to cache. The server console or the client console never returns an error as well which is a pain.

if hasColors is the same as if hasColors == true

You do a pcall function but you are not using it

Try using this and tell if it works

I do agree with you that I should have been utilizing the pcall function a bit more and thanks for bringing that to my attention. Although it doesn’t seem to make much of a difference when I am running the code, the same problem still goes on.

@megatank58 I think the problem may have been that I have been testing the purchases in the Local Server, but after doing further research apparently :UserOwnsGamePassAsync doesn’t work in Local Servers. Now that I think of it this would make sense since it won’t actually get stored. Is the only way I can actually test if it works by buying it with robux?

No,you can use Play Solo to test this without local Server

Wait what is play solo? won’t it still require you to purchase robux since its not being locally tested?

Play Solo or “Play here” Is the normal mode and you can easily use this and No it doesn’t requires robux

Lol Sorry it took me forever since I had to get on my other account, but the play here still doesn’t work with testing.playhere It is this you are talking about correct?

Yes that what i was mentioning
EDIT: Try in game once

I changed the value of the GP to 1 robux, and tested it in game and it worked. Guess it just doesn’t work in studio. But anyway thanks for all of the help @megatank58!

Everything works in studio except for :UserOwnsGamePassAsync()

No problem also i think it was probably a network issue with studio

You might also mark it as solution just in case

1 Like