Is it a good idea to call UserOwnsGamePassAsync a bunch?

I read here that UserHasPass caches the result so it won’t have to do any API calls to test whether they have it (I assume). Does that mean that it’s not a good idea to call UserOwnsGamePassAsync a lot? If it isn’t a good idea, then should I make my own gamepass cache manager so it doesn’t call the API a lot?

You could use a ModuleScript to get the boolean value and just require that.

This works because the ModuleScript only runs once, and when is required, it passes its return value straight to the script.

For more information see: ModuleScript | Documentation - Roblox Creator Hub

Hope this helps,
-Tom :slight_smile:

I’m not sure why you would need to call it “a lot”. Call it as much as necessary.
As it caches the result you should not have to worry about it doing too many API calls.

Oh, is this a more recent change to UserOwnsGamePassAsync? I read in that post that it doesn’t cache, but that’s old now.

I’m not sure if you are talking about MarketplaceService | Documentation - Roblox Creator Hub or GamePassService | Documentation - Roblox Creator Hub

You should not be using the gamepass service except for old gamepass id’s I think.
In the article it says that if the user owns the pass when joining it will cache the result. You should read the Dev Hub page: MarketplaceService | Documentation - Roblox Creator Hub

Sorry for the confusion! I typed the name wrong lol. Anyways, yes, it would appear that it caches, so thanks for your help.