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: Why wont this gave a player points when they purchase?

Previous Thread :: Next Thread 
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
14 Aug 2015 08:50 AM
MarketplaceService.PromptPurchaseFinished:connect(function(player, assetId, isPurchased)
if isPurchased then
if assetId == 25611508 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 10000
elseif assetId == 25611534 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 50000
end
end
end)

I know the cash inside player isnt the problem. It is the detecting if purchased. What is wrong with this? When a player purchases the pass, it wont give them more cash. Markerplaceservice was already defined.
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
14 Aug 2015 08:54 AM
is this for a dev product or gamepass?

"If you are good at something, never do it for free." - The Joker
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
14 Aug 2015 09:03 AM
Developer Products

And btw I figured out 1 mistake but it still wont work. Here is what I have now.


MarketplaceService.PromptProductPurchaseFinished:connect(function(player, assetId, isPurchased)
if isPurchased then
if assetId == 25611508 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 10000
elseif assetId == 25611534 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 50000
end
end
end)
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
14 Aug 2015 09:05 AM
Mistake is you're using PromptProductPurchaseFinished. Use ProcessReceipt.

http://wiki.roblox.com/index.php?title=ProcessReceipt_(Callback)

Also cut down on your WaitForChilds... if you wait for it once, why wait again? e.e

"If you are good at something, never do it for free." - The Joker
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
14 Aug 2015 09:07 AM
^
btw, abstract, why u no answer my messages? XD

"My Life is going Good... but..."
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
14 Aug 2015 09:08 AM
Been busy recently with football. Msg me again

"If you are good at something, never do it for free." - The Joker
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
14 Aug 2015 09:11 AM
MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
if PurchaseHistory:GetAsync(playerProductKey) then
return Enum.ProductPurchaseDecision.PurchaseGranted --We already granted it.
end
for i, player in ipairs(game.Players:GetPlayers()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == 25611508 then
player:WaitForChils("Cash").Value = player:WaitForChild("Cash").Value + 10000
elseif receiptInfo.ProductId == 25611534 then
player:WaitForChils("Cash").Value = player:WaitForChild("Cash").Value + 50000
elseif receiptInfo.ProductId == 25617123 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 100000
end
end
end
PurchaseHistory:SetAsync(playerProductKey, true)
return Enum.ProductPurchaseDecision.PurchaseGranted
end


So would this work? WOuld it work more than once?
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
14 Aug 2015 09:17 AM
Would this work?

MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetPlayers()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == 25611508 then
player:WaitForChils("Cash").Value = player:WaitForChild("Cash").Value + 10000
elseif receiptInfo.ProductId == 25611534 then
player:WaitForChils("Cash").Value = player:WaitForChild("Cash").Value + 50000
elseif receiptInfo.ProductId == 25617123 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 100000
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Report Abuse
Drakles is not online. Drakles
Joined: 19 Oct 2014
Total Posts: 1066
14 Aug 2015 09:18 AM
WaitForChils; until you fix your typo, no. I don't think so.

Life is short, so grip it and rip it.
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
14 Aug 2015 09:19 AM
I fixed that. Now should it work?

MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetPlayers()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == 25611508 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 10000
elseif receiptInfo.ProductId == 25611534 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 50000
elseif receiptInfo.ProductId == 25617123 then
player:WaitForChild("Cash").Value = player:WaitForChild("Cash").Value + 100000
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
14 Aug 2015 09:23 AM
stop using waitforchild...

"If you are good at something, never do it for free." - The Joker
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
14 Aug 2015 11:12 AM
abstract, I mean on Skype XD

"My Life is going Good... but..."
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