Should the server check UserOwnsGamePassAsync or trust saved data?

After a player buys a gamepass, the data is saved.

Should the server check if the player owns a gamepass via the DataStore or with the inbuilt roblox function?

1 Like

I’d check the datastore first and if it comes up as false, you can check the if the player owns the gamepass with the API. This is most effective if you plan on manually giving players access to gamepass-locked perks

(I’m assuming you mean Datastore as in a datastore you’re making and writing info into yourself. Correct me if I’m wrong.)

I would recommend using the “UserOwnsGamePassAsync” function.


– UserOwnsGamePassAsync –
Pros:

  1. Simpler
  2. Safer

Cons:

  1. Slower to retrieve info
  2. Will error if API is down

– Datastore –
Pros:

  1. Faster to retrieve info
  2. Can save with custom info (bought timestamps, etc…)

Cons:

  1. Could corrupt
  2. Edge cases
  3. Uglier scripts

It also just depends on your use case.
(there are more pros and cons for both but idk anymore of the top of my head)

1 Like

always use UserOwnsGamePassAsync, adding onto the reasons stated above:

  • a player can refund/“delete” gamepasses
  • ownership is tied to roblox, not your games data
  • roblox’s backend is probably 100x more reliable then regular datastores
  • if a player buys a gamepass outside of your game you would have no wouldnt know.

dont do this, this would just add another api call for players who dont own your gamepass for no reason

if you need to save custom info about the gamepass (like when they bought it), get the players data AFTER checking if they own it. if they have the gamepass but no data was found, save the latest / “default” data.

3 Likes

Yeah my thought process was very similar. Players can delete their own gamepass. Also roblox is way more reliable too.

1 Like

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