How to use datastores to check if a player has bought a developer product?

I made a few developer products that players can use to donate different amounts of robux and then earn some donator perks. I didn’t want to use gamepasses because gamepasses are a one-time purchase.

I know you can use datastores to record a purchase of a developer product, but I’m not very knowledgeable on how datastores work.

Firstly, how do I record a purchase on a datastore?
Secondly, how do I check if a player has at least one purchase recorded on the datastore? This is for giving the donator perks to players.

There is an example of this on MarketplaceService | Roblox Creator Documentation

You can set specific players’ data with their specific key each time a dev product is purchased. Of course, you can tweak how the data is saved to your liking.

1 Like

Thanks, I just watched a video on how datastores work.