Localscript:
--Variables-- local Button = workspace.Shop.Buy_fifty_Coins.Purchase_Button.SurfaceGui.Button local id = 933602329 local MP = game:GetService("MarketplaceService") local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait(0.01) --<--->-- Button.Activated:Connect(function() MP:PromptProductPurchase(player,id) end)
server script:
local MP = game:GetService("MarketplaceService") local DTS = game:GetService("DataStoreService") local Savevalues = DTS:GetDataStore("SaveValues") local Id = 933602329 MP.PromptPurchaseFinished:Connect(function(player, Id, isPurchased) local Credits = player:WaitForChild("Currency").Credits print("Runned") if isPurchased then print("working") Credits.Value = Credits.Value +50 local Fol = player:WaitForChild("Currency") local tosave = {} for i,v in pairs(Fol:GetChildren())do tosave[#tosave + 1] = v.Value end pcall(function() Savevalues:SetAsync(player.UserId,tosave) print(player.Name.." Bought fifty Credits!") end) end end)
PromptPurchaseFinished doesn't fire for developer products. I believe the thing you want to use for this is the ProcessReceipt.