generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: .ProcessReceipt() Not working.

Previous Thread :: Next Thread 
waverlycole is not online. waverlycole
Joined: 30 Nov 2010
Total Posts: 139
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 is not online. KreoBox
Joined: 24 Aug 2016
Total Posts: 356
16 Sep 2016 06:36 PM
Fix your code.
Report Abuse
waverlycole is not online. waverlycole
Joined: 30 Nov 2010
Total Posts: 139
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
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
16 Sep 2016 08:06 PM
Can you show us the code you used to call it?
Report Abuse
waverlycole is not online. waverlycole
Joined: 30 Nov 2010
Total Posts: 139
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
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
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
waverlycole is not online. waverlycole
Joined: 30 Nov 2010
Total Posts: 139
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
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
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
waverlycole is not online. waverlycole
Joined: 30 Nov 2010
Total Posts: 139
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
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
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
waverlycole is not online. waverlycole
Joined: 30 Nov 2010
Total Posts: 139
16 Sep 2016 08:24 PM
How would i do that?


#code print("Noice")
Report Abuse
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
16 Sep 2016 08:27 PM
Only return PurchaseGranted if one of those if statements are triggered
Report Abuse
WildGuest is not online. 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
waverlycole is not online. waverlycole
Joined: 30 Nov 2010
Total Posts: 139
16 Sep 2016 09:17 PM
This is the script to process purchases...?


#code print("Noice")
Report Abuse
waverlycole is not online. waverlycole
Joined: 30 Nov 2010
Total Posts: 139
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image