Everything works fine the problem is I am trying to paste my gamepass ID on roblox but when you test on Roblox Studio this IDs doesnt match. Like this
SSS script
local mps = game:GetService("MarketplaceService")
local coinsProductIDs =
{
[21814745] = 10,
[21815193] = 100,
[21815215] = 1000,
[21815232] = 10000,
}
mps.ProcessReceipt = function(purchaseInfo)
local plrPurchased = game.Players:GetPlayerByUserId(purchaseInfo.PlayerId)
if not plrPurchased then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
for productID, coinsGiven in pairs(coinsProductIDs) do
if purchaseInfo.ProductId == productID then
plrPurchased.toolLeaderstats.Credits.Value = plrPurchased.toolLeaderstats.Credits.Value + coinsGiven
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
Local script (inside the GUIs for buy)
local mps = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer
local coinsProductIDs =
{
21814745,
21815193,
21815215,
21815232,
}
local purchase10CoinsBtn = script.Parent.BuyCredits1
local purchase100CoinsBtn = script.Parent.BuyCredits2
local purchase1000CoinsBtn = script.Parent.BuyCredits3
local purchase10000CoinsBtn = script.Parent.BuyCredits4
local function purchaseCoinsFunction(key)
local idToPurchase = coinsProductIDs[key]
mps:PromptProductPurchase(plr, idToPurchase)
end
purchase10CoinsBtn.MouseButton1Click:Connect(function()
purchaseCoinsFunction(1)
end)
purchase100CoinsBtn.MouseButton1Click:Connect(function()
purchaseCoinsFunction(2)
end)
purchase1000CoinsBtn.MouseButton1Click:Connect(function()
purchaseCoinsFunction(3)
end)
purchase10000CoinsBtn.MouseButton1Click:Connect(function()
purchaseCoinsFunction(4)
end)
I will show you.
Test pass - Roblox < this is one gamepass I have on my game, was you can see the ID is “21814745” but in game is something really random…
I dont know why my game pass doesnt come to the screen and this random gamepass shows up.
Same thing with others buttons.