wayne2018
|
  |
| Joined: 04 Jun 2014 |
| Total Posts: 2509 |
|
|
| 24 Jan 2016 12:51 AM |
Doesn't work for some reason
local buyButton = script.Parent local productId = 31361987 --change to dev product id local mps = game:GetService"MarketplaceService"
function getPlayerById(id) for i,v in pairs(game.Players:GetPlayers()) do if v.userId == id then return v end end end
buyButton.MouseButton1Click:connect(function() mps:PromptProductPurchase(game.Players.LocalPlayer, productId) end)
mps.ProcessReceipt = function(info) local plr = getPlayerById(info.PlayerId) if plr and plr:FindFirstChild"leaderstats" and plr.leaderstats:FindFirstChild"Coins" then plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 50 end end |
|
|
| Report Abuse |
|
|
wayne2018
|
  |
| Joined: 04 Jun 2014 |
| Total Posts: 2509 |
|
| |
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
| |
|
wayne2018
|
  |
| Joined: 04 Jun 2014 |
| Total Posts: 2509 |
|
| |
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 24 Jan 2016 01:24 AM |
Did u free model it, cause if you dont know what a script output is by now and your that far into scripting its hard to believe. A script output is an output that tells locates errors in scripts when you test in studio. Thats why many scripters like to put prints in between the scripts so if it breaks they know where because it prints in the output and u can find were the last print was and then stopped.
|
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 24 Jan 2016 01:24 AM |
| Output is a window used for script debugging. It's like Explorer sorta. It will tell you (in most cases) why a script isn't working. |
|
|
| Report Abuse |
|
|
wayne2018
|
  |
| Joined: 04 Jun 2014 |
| Total Posts: 2509 |
|
|
| 24 Jan 2016 01:40 AM |
"Did u free model it" Well, yes. I was studying different free models for their code/scripts and came upon this model that doesn't work. I dug through the scripts and it looked fine to me. It was really bugging me to find out why it doesn't work so that's why I'm here. Hopefully I won't get too much hate for this... |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 24 Jan 2016 01:42 AM |
Well you admit it so you really shouldn't
|
|
|
| Report Abuse |
|
|
wayne2018
|
  |
| Joined: 04 Jun 2014 |
| Total Posts: 2509 |
|
|
| 24 Jan 2016 01:45 AM |
| I just checked the output and nothing came up. |
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 24 Jan 2016 01:46 AM |
what are you trying to do exactly when a person buys the product?
|
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
| |
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 24 Jan 2016 01:51 AM |
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent local link = game:GetService("MarketplaceService") deb = 0
script.Parent.MouseButton1Click:connect(function() local marketId = 31361987
link:PromptProductPurchase(plr,marketId) link.ProcessReceipt = function(receiptInfo) if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then if deb == 0 then deb = 1 plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 50 deb = 0 end end end end)
|
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 24 Jan 2016 01:52 AM |
edit the parents in which the script is located
|
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 24 Jan 2016 01:53 AM |
Forgot to mention, put this in a server script not a local script.
|
|
|
| Report Abuse |
|
|
wayne2018
|
  |
| Joined: 04 Jun 2014 |
| Total Posts: 2509 |
|
|
| 24 Jan 2016 02:06 AM |
| Still can't get it to work ;-; |
|
|
| Report Abuse |
|
|