|
| 16 Sep 2016 06:14 PM |
It was working a few days ago, now the player has to rejoin the game for it to work. Any advice?
#code print("Noice") |
|
|
| Report Abuse |
|
|
KreoBox
|
  |
| Joined: 24 Aug 2016 |
| Total Posts: 356 |
|
| |
|
|
| 16 Sep 2016 08:05 PM |
Its been working over a month, and i havent changed any code. It just stopped working. Thanks for the help though :)
#code print("Noice") |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:06 PM |
| Can you show us the code you used to call it? |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:12 PM |
local Market = game:GetService("MarketplaceService")
Market.ProcessReceipt = function(receiptInfo) for i,player in pairs(game.Players:GetChildren()) do if player.UserId == receiptInfo.PlayerId then repeat wait() until player.PlayerGui:FindFirstChild('Store') local tags = player:FindFirstChild('leaderstats'):FindFirstChild('Tags') if receiptInfo.ProductId == 34807514 then tags.Value = tags.Value + 10 print(player.Name.." bought 10 Tags.") elseif receiptInfo.ProductId == 34807531 then tags.Value = tags.Value + 20 print(player.Name.." bought 20 Tags.") elseif receiptInfo.ProductId == 34807546 then tags.Value = tags.Value + 50 print(player.Name.." bought 50 Tags.") elseif receiptInfo.ProductId == 34985085 then tags.Value = tags.Value + 100 print(player.Name.." bought 100 Tags.") elseif receiptInfo.ProductId == 34807584 then tags.Value = tags.Value + 500 print(player.Name.." bought 500 Tags.") elseif receiptInfo.ProductId == 34807577 then tags.Value = tags.Value + 1000 print(player.Name.." bought 1000 Tags.") end end end print("PurchaseGranted") return Enum.ProductPurchaseDecision.PurchaseGranted end
#code print("Noice") |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:15 PM |
| Why are you using a loop to find a player? Just use GetPlayerByUserId. As for it not working at all why doesn't it send a purchase denied in case it fails? |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:16 PM |
If it fails it wont auto send purchase failed? Also, ive just had it use print to announce the id of the item purchased, even that doesnt work.
#code print("Noice") |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:20 PM |
| The return value by default is nil, so if you don't want nil then you need to define something. |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:21 PM |
Oh. Here is new code, would this work?
local Market = game:GetService("MarketplaceService")
Market.ProcessReceipt = function(receiptInfo) local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId) repeat wait() until player.PlayerGui:FindFirstChild('Store') local tags = player:FindFirstChild('leaderstats'):FindFirstChild('Tags') if receiptInfo.ProductId == 34807514 then tags.Value = tags.Value + 10 print(player.Name.." bought 10 Tags.") elseif receiptInfo.ProductId == 34807531 then tags.Value = tags.Value + 20 print(player.Name.." bought 20 Tags.") elseif receiptInfo.ProductId == 34807546 then tags.Value = tags.Value + 50 print(player.Name.." bought 50 Tags.") elseif receiptInfo.ProductId == 34985085 then tags.Value = tags.Value + 100 print(player.Name.." bought 100 Tags.") elseif receiptInfo.ProductId == 34807584 then tags.Value = tags.Value + 500 print(player.Name.." bought 500 Tags.") elseif receiptInfo.ProductId == 34807577 then tags.Value = tags.Value + 1000 print(player.Name.." bought 1000 Tags.") end print("PurchaseGranted") return Enum.ProductPurchaseDecision.PurchaseGranted end
#code print("Noice") |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:23 PM |
| Only return PurchaseGranted if it is successful, otherwise they can not pay you anything and still get something. |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:24 PM |
How would i do that?
#code print("Noice") |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 08:27 PM |
| Only return PurchaseGranted if one of those if statements are triggered |
|
|
| Report Abuse |
|
|
WildGuest
|
  |
| Joined: 28 Feb 2010 |
| Total Posts: 647 |
|
|
| 16 Sep 2016 08:34 PM |
Did you add a second script that processes purchases?
|
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 09:17 PM |
This is the script to process purchases...?
#code print("Noice") |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2016 09:20 PM |
local Market = game:GetService("MarketplaceService")
Market.ProcessReceipt = function(receiptInfo) local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId) repeat wait() until player.PlayerGui:FindFirstChild('Store') local tags = player:FindFirstChild('leaderstats'):FindFirstChild('Tags') if receiptInfo.ProductId == 34807514 then tags.Value = tags.Value + 10 print(player.Name.." bought 10 Tags.") print("PurchaseGranted") return Enum.ProductPurchaseDecision.PurchaseGranted elseif receiptInfo.ProductId == 34807531 then tags.Value = tags.Value + 20 print(player.Name.." bought 20 Tags.") print("PurchaseGranted") return Enum.ProductPurchaseDecision.PurchaseGranted elseif receiptInfo.ProductId == 34807546 then tags.Value = tags.Value + 50 print(player.Name.." bought 50 Tags.") print("PurchaseGranted") return Enum.ProductPurchaseDecision.PurchaseGranted elseif receiptInfo.ProductId == 34985085 then tags.Value = tags.Value + 100 print(player.Name.." bought 100 Tags.") print("PurchaseGranted") return Enum.ProductPurchaseDecision.PurchaseGranted elseif receiptInfo.ProductId == 34807584 then tags.Value = tags.Value + 500 print(player.Name.." bought 500 Tags.") print("PurchaseGranted") return Enum.ProductPurchaseDecision.PurchaseGranted elseif receiptInfo.ProductId == 34807577 then tags.Value = tags.Value + 1000 print(player.Name.." bought 1000 Tags.") print("PurchaseGranted") return Enum.ProductPurchaseDecision.PurchaseGranted end end
#code print("Noice") |
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 16 Sep 2016 10:10 PM |
| ew use a table and get rid of that nasty if statement!! |
|
|
| Report Abuse |
|
|