I have problem with developer products. It is not giving a player currency or only one button works.
local DataStoreService = game:GetService("DataStoreService")
local LeaderstatDataStore = DataStoreService:GetDataStore('SaveValue')
local DeveloperProductID = 1570317441 -- Change this ID with your Developer Product ID
game.Players.PlayerAdded:Connect(function(player)
local Leaderstat = player.leaderstats.hiddenfolder.Coins
local LeaderstatKey = player.UserId .. "_Coins"
local success, savedValue = pcall(function()
return LeaderstatDataStore:GetAsync(LeaderstatKey)
end)
if success and savedValue then
Leaderstat.Value = savedValue
end
local Purchased = false
game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
if receiptInfo.PlayerId == player.UserId and receiptInfo.ProductId == DeveloperProductID and not Purchased then
Purchased = true
Leaderstat.Value += 100
local Success, error = pcall(function()
LeaderstatDataStore:SetAsync(LeaderstatKey, Leaderstat.Value)
end)
if not Success then
warn("Failed to save leaderstat data:", error)
end
Purchased = false
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end)