DataStore making

Hello, I’m making a data store. It worked in studio but not in-game. you buy currency and it goes to the datastore. I have the new datastore I’m making but I’m confused on how to make it. The original one didn’t work because there were multiple scripts.

IM WONDERING
How to incorporate everything in the original script to work in this one. Since they were in different scripts.

Here is the old one

Here is the one im making.

Assuming the currency purchase would be from a developer product, you’d want to save the new total currency in the event of MarketplaceService.ProcessReceipt, don’t forget though that after saving the player’s data it is very important that you return Enum.ProductPurchaseDecision.PurchaseGranted!