About 10 minutes ago, all my devproducts were working, I just made some updates, and now none of them work!
I can buy them, but my stage doesnt go up at all!
Here is my script:
local MPS = game:GetService('MarketplaceService')
MPS.ProcessReceipt = function(recieptInfo)
if recieptInfo.ProductId == 959727180 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = Player.leaderstats.Stage.Value + 1
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959728287 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = Player.leaderstats.Stage.Value + 2
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959744665 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = Player.leaderstats.Stage.Value + 5
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959761604 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = 13
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
I’m pretty sure you’d have to convert the data to a number before adding it, like this:
local MPS = game:GetService(‘MarketplaceService’)
MPS.ProcessReceipt = function(recieptInfo)
if recieptInfo.ProductId == 959727180 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = tonumber(Player.leaderstats.Stage.Value) + 1
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959728287 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = tonumber(Player.leaderstats.Stage.Value) + 2
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959744665 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = tonumber(Player.leaderstats.Stage.Value) + 5
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959761604 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = 13
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
I could be wrong, but any information on what’s outputted would be useful.
no… No errors at all…
And I’m using this script to trigger it:
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local MPS = game:GetService('MarketplaceService')
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(Player, 959727180)
end)
Ok, so in the end, I ended up reverting the Game Version, and it works, the script is this:
local MPS = game:GetService('MarketplaceService')
MPS.ProcessReceipt = function(recieptInfo)
if recieptInfo.ProductId == 959727180 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = Player.leaderstats.Stage.Value + 1
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959728287 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = Player.leaderstats.Stage.Value + 2
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959744665 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = Player.leaderstats.Stage.Value + 5
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif recieptInfo.ProductId == 959761604 then
local Player = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
Player.leaderstats.Stage.Value = 13
Player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
Ok, so I found the issue!
It was a donation board I was using, I put it into the game, and it stopped working, took it out, and started working again, how could this cause the issue?
If you’re using the donation board by Nitefal, then Polyheximal is right. Sorry for the late response, but I feel like this falls under the relevant information category of bumping old topics since it could help out other devs that are using the same donation board, and that I haven’t seen anybody mention it.
Anyway, the donation board reads, “If you’re already using the function ProcessReceipt then you must add custom code for this board to work, as only one of these functions may be used in a game. You can update the board’s datastore with this line:”
So, simply add this plus the parameters to your dev product handling script and boom, the donation board and your developer products will work again. Example:
elseif receiptInfo.ProductId == 1004632422 then -- replace with your ID here
local PlayerId = receiptInfo.PlayerId
local ProductPrice = 10
game:GetService("DataStoreService"):GetOrderedDataStore("TopDonators"):IncrementAsync(PlayerId, ProductPrice)
return Enum.ProductPurchaseDecision.PurchaseGranted
@bobo1004 is somewhat right. The leaderboard for the donation board doesn’t update, which is the only problematic thing about this solution. If anyone knows how to make the leaderboard update, that’d be great!