Dave_Here
|
  |
| Joined: 13 May 2016 |
| Total Posts: 319 |
|
|
| 11 Jan 2017 11:01 PM |
I can't for the life of me figure out why this isn't working. I've been researching online and watching video's and I'm wondering if there is a small mistake somewhere. I appreciate any advice you can offer. Thanks
*script under ServerScriptService labeled DeveloperPrductHandler*
local MarketplaceService = game:GetService("MarketplaceService") local buyKK = 47706061 --10
MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == buyKK then player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 9001 end end end return Enum.ProductPurchaseDecision.PurchaseGranted end
*Local script under StarterGui labeled KKBuy*
local buyKK = 47706061 --10
script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, buyKK) end)
The button works fine. When you click it it takes the robux away and says your purchase is good. It doesn't give me any stats. I've put a bunch of print("test") through out the DeveloperPrductHandler script and none of them show on the server script. Do you notice anything I did wrong? |
|
|
| Report Abuse |
|
|
Briicks
|
  |
| Joined: 03 Apr 2015 |
| Total Posts: 1796 |
|
|
| 12 Jan 2017 12:54 AM |
Add some prints in there and see how far it gets.
|
|
|
| Report Abuse |
|
|
Dave_Here
|
  |
| Joined: 13 May 2016 |
| Total Posts: 319 |
|
|
| 12 Jan 2017 08:17 AM |
I had a print test here and it never prints
MarketplaceService.ProcessReceipt = function(receiptInfo) print("test3") for i, player in ipairs(game.Players:GetChildren()) do
This print test does print both print test.
script.Parent.MouseButton1Click:connect(function() print("test1") game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, buyKK) print("test2") end) |
|
|
| Report Abuse |
|
|
pketny
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1162 |
|
|
| 12 Jan 2017 08:37 AM |
Do you have FE on?
Maybe FE is blocking the PromptProductPurchase request from reaching the server, not sure. |
|
|
| Report Abuse |
|
|
Dave_Here
|
  |
| Joined: 13 May 2016 |
| Total Posts: 319 |
|
|
| 12 Jan 2017 09:11 AM |
| FilteringEnabled is not on. Thanks for the suggestion. |
|
|
| Report Abuse |
|
|
Dave_Here
|
  |
| Joined: 13 May 2016 |
| Total Posts: 319 |
|
|
| 12 Jan 2017 09:57 AM |
| When I click the button it loads the product image and description all good. It seems to be just the MarketplaceService.ProcessReceipt = function(receiptInfo) that never gets run. Anyone see anything that I might be doing wrong? |
|
|
| Report Abuse |
|
|
Dave_Here
|
  |
| Joined: 13 May 2016 |
| Total Posts: 319 |
|
|
| 12 Jan 2017 10:01 AM |
I tested with this.
script.Parent.MouseButton1Click:connect(function() print("test0") game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, buyKK) print("test00") end)
When I click the button before I click the buy on the pop up screen both Test print run. Should the second test00 run before I even select buy on the pop up? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
| |
|
Dave_Here
|
  |
| Joined: 13 May 2016 |
| Total Posts: 319 |
|
|
| 12 Jan 2017 11:26 AM |
To simplify things. The below script doesn't even print test1
local MarketplaceService = game:GetService("MarketplaceService") local buyKK = 47706061 --10
MarketplaceService.ProcessReceipt = function(receiptInfo) print("test1") end
local buyKK = 47706061 --10 local buy = script.Parent
buy.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, buyKK) end)
Any idea's why the MarketplaceService isn't being called when the button is clicked? The purchase works and removes the robux. But test1 never prints. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2017 11:46 AM |
I've had the same problem lol You can only have this part:
MarketplaceService.ProcessReceipt = function(receiptInfo) print("test1") end
In one single script. So this is how mine looks like:
local MarketplaceService = game:GetService("MarketplaceService") local ds = ga###################################################################MarketplaceService.ProcessReceipt = function(receiptInfo) for i, p in ipairs(game.Players:GetChildren()) do if p.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == getIdj() then addV(p.JumpPower,5) elseif receiptInfo.ProductId == getIds() then addV(p.Speed,1) elseif receiptInfo.ProductId == getIdt() then addV(p.Strength,20) elseif receiptInfo.ProductId == getIdv() then addV(p.VotingPower,1) elseif receiptInfo.ProductId == 47435421 then addV(p.NSpamshot,1) elseif receiptInfo.ProductId == 47435446 then addV(p.NShotgun,1) elseif receiptInfo.ProductId == 47########hen addV(p.NDodge,1) elseif receiptInfo.ProductId ==##7########hen addV(p["NMega Jump"],1) elseif receiptInfo.ProductId == 47435551 then
(Left out the rest)
So basically, the first script with that function runs, the rest doesn't. Sad but true. |
|
|
| Report Abuse |
|
|
Dave_Here
|
  |
| Joined: 13 May 2016 |
| Total Posts: 319 |
|
|
| 12 Jan 2017 12:13 PM |
| You sir are the MAN! My initial script was working. At that point I started making a new script for all my buttons. When I went to work on it the next day it wasn't working and I thought I must have messed something else up. After deleting all the other script buttons it now works. Thank You! |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2017 04:17 PM |
| Np. I had the same problem and it drove me crazy |
|
|
| Report Abuse |
|
|
Dave_Here
|
  |
| Joined: 13 May 2016 |
| Total Posts: 319 |
|
|
| 12 Jan 2017 05:50 PM |
I'm having 1 other issue with it. Every thing works great when testing locally. When I upload it or test on test server it doesn't run the MarketplaceService.ProcessReceipt = function(receiptInfo)
Works fine on local test. Any ideas?
|
|
|
| Report Abuse |
|
|