Why does only one dev product give me value when purchased and the other doesn't?
Hey there!
Would anyone be able to help me with this script? I would really appreciate it.
Right, so this script (when purchased a dev product) won't work. I don't know is it the button script, or the script that has the MarketplaceService.ProcessReceipt in it.
Whenever I buy the first product it works and gives me, though when I buy the second, it doesn't work. Just doesn't give me no value.
Also the button script is located in a gui. Then, a frame with all the buttons in it. Just some extra information!
Would anyone know what the problem is?
Is it the button script or the main script?
I'd really love some help and thank you so much for reading. It means a lot and I really appreciate that you even clicked on this to help me. All that just means so much to me. :)
Button script:
01 | for i,v in pairs (script.Parent.Buttons:GetChildren()) do |
02 | if v:isA( "TextButton" ) then |
03 | v.MouseButton 1 Click:connect( function () |
05 | if v:FindFirstChild( "Pass" ) then |
06 | for i,v in pairs (script.Parent.Buttons:GetChildren()) do |
07 | if v:isA( "TextButton" ) then |
08 | v.MouseButton 1 Click:connect( function () |
10 | if v:FindFirstChild( "Pass" ) then game.MarketplaceService:PromptPurchase(game.Players.LocalPlayer, tonumber (v.Name)) else game.MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, tonumber (v.Name)) |
Main script:
01 | game.StarterGui.ResetPlayerGuiOnSpawn = false |
02 | old_fog = game.Lighting.FogStart |
03 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
05 | function getPlayerFromId(id) |
06 | for i,v in pairs (game.Players:GetChildren()) do |
07 | if v.userId = = id then |
14 | MarketplaceService.ProcessReceipt = function (receiptInfo) |
15 | local productId = receiptInfo.ProductId |
16 | local playerId = receiptInfo.PlayerId |
17 | local player = getPlayerFromId(playerId) |
21 | if productId = = 1135297211 then |
23 | local stats = game.ServerStorage.PlrFolder |
24 | local pf = stats:FindFirstChild(player.Name) |
26 | stats:FindFirstChild(player.Name) |
27 | local strength = pf.Strength |
29 | pf.Strength.Value = pf.Strength.Value + 5 |
31 | productId = = 1135297212 then |
33 | local stats = game.ServerStorage.PlrFolder |
34 | local pf = stats:FindFirstChild(player.Name) |
35 | stats:FindFirstChild(player.Name) |
36 | local strength = pf.Strength |
38 | pf.Strength.Value = pf.Strength.Value + 20 |
42 | return Enum.ProductPurchaseDecision.PurchaseGranted |