I was wondering if you could poissibly store dev product purchases so once they have been purchased they stay with you forever, like if they buy a sword, when they come back the game would recongnise it and give them the sword. I can't create gamepasses cause my game seems to be broken so I cant create a single pass. I was thinking maybe Data Store. I have looked at the dev product wiki but need help with server side and putting in the datastote.
-- Server side local MarketplaceService = Game:GetService("MarketplaceService") MarketplaceService.ProcessReceipt = function(receiptInfo) game.Workspace.DisplayScreen.SurfaceGui.TextBox.Text = receiptInfo.PlayerId .. " just bought " .. receiptInfo.ProductId -- ... -- use DataStore to record purchase -- ... return Enum.ProductPurchaseDecision.PurchaseGranted end
-- Client side local MarketplaceService = Game:GetService("MarketplaceService") local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton local productId = "ID" buyButton.MouseButton1Click:connect(function() MarketplaceService:PromptProductPurchase(player, productId) end)
So basically, you are wanting to use the DataStore to record that a specific user has a specific item.
First you need to create a DataStore.
local DataStore = game:GetService("DataStoreService"):GetDataStore("ProductPurchases")
Recording the purchase:
local key = "userId" .. tostring(userId) .. "_productId" .. tostring(productId) DataStore:SetAsync(key, true)
Now when you're checking if the user has the product, you need to form the same key and use DataStore:GetAsync(key). It will return nil if the key hasn't been set yet.
local key = "userId" .. tostring(userId) .. "_productId" .. tostring(productId) if DataStore:GetAsync(key) == true then print("Player bought the product") end