Don't cache PlayerHasPass when the player leaves

It’s bad enough that it caches false, but if a player buys a gamepass after they join, they need to leave and find a different server to join before the purchase will have any effect. ProcessReceipt only works for developer products, so there’s no listening for purchases. PlayerHasPass caches even after the player leaves, so they can’t rejoin the only server and expect it to work. They need to wait until everybody else leaves.

1 Like

A good solution would be to break the cache if PromptPurchase is called. It’s already doing the lookup to tell them whether they already have it or to show them the buy button, so the game should be allowed to know, too. If this already is the case then it should be documented.

There are listeners for completed gamepass purchases in-game, this is probably what you’re seeking.

If not, then a while loop for checking :PlayerOwnsAsset() is good enough.

PlayerOwnsAsset no longer works on GamePasses in studio, but still online

2 Likes

Just made a new game that’s blown up yesterday and I decided to use gamepasses because players stilll apparently look into the ‘Store’ section of a games page. I can confirm that they still sell well.

1 Like

This is a great solution for most cases. Players are also able to purchase gamepasses from the website though, so ideally it’d be great if we could see improvements to caching still.

4 Likes

@Seranok Was this part of the change to badges that started enforcing usage of proper methods? PlayerHasPass is not suitable for a production level game. Please disable caching for PlayerHasPass so it’s not useless. Just saw a bug report come in because PlayerHasPass wasn’t returning correct results due to caching. There is also another thread concerning the issue here.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.