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)
end)
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
print(hasColors)
elseif hasColors == false then
print(hasColors) -- Just used to see what the Value is in hasColors
marketPlaceServ:PromptGamePassPurchase(Player, colorsID)
end
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.
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.
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?
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. It is this you are talking about correct?
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()