Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
|
| 30 May 2014 07:01 PM |
How does one make?? The wiki is no help. This is all I got from the wiki...
local MarketplaceService = Game:GetService("MarketplaceService") local buyButton = script.Parent local productId = 19976127 buyButton.MouseButton1Click:connect(function() MarketplaceService:PromptProductPurchase(player, productId) end)
--Where am I supposed to put my code D: |
|
|
| Report Abuse |
|
|
|
| 30 May 2014 07:01 PM |
This would go in a TextButton
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
|
| 30 May 2014 07:02 PM |
| Yea, no crap. I edited it to go to a textbutton... Now will you help me or not |
|
|
| Report Abuse |
|
|
DataStore
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 8540 |
|
|
| 30 May 2014 07:06 PM |
You've not exactly said what you need help with, other than asking where to put your code (which is what Swim told you). Oh, and also, 'player' is a nil value in your given script.
If you're asking how to award something to someone, once they've bought your developer product, then look into ProcessReceipt. |
|
|
| Report Abuse |
|
|
|
| 30 May 2014 07:12 PM |
There's no need to be rude, I answered your question.
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
|
| 30 May 2014 07:18 PM |
| Where is the server script? You said you got this off the Wiki right? |
|
|
| Report Abuse |
|
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
|
| 30 May 2014 07:33 PM |
Here is the whole script for one button. There is an error on line 16 that says something like "Player should be of type 'player' but is of type nil"
local MarketplaceService = Game:GetService("MarketplaceService") MarketplaceService.ProcessReceipt = function(receiptInfo) game.Workspace.DisplayScreen.SurfaceGui.TextBox.Text = receiptInfo.PlayerId .. " just bought " .. receiptInfo.ProductId -- ... -- use DataStore to record purchase -- ... return Enum.ProductPurchaseDecision.PurchaseGranted end
local MarketplaceService = Game:GetService("MarketplaceService") local buyButton = script.Parent local productId = 19976127 buyButton.MouseButton1Click:connect(function() MarketplaceService:PromptProductPurchase(player, productId) end)
local MarketplaceService = game:GetService("MarketplaceService") local NumosID = 19976127 local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") MarketplaceService.ProcessReceipt = function(receiptInfo) local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId if PurchaseHistory:GetAsync(playerProductKey) then return Enum.ProductPurchaseDecision.PurchaseGranted end for i, player in ipairs(game.Players:GetPlayers()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == NumosID then player.Stats.Numos.Value = player.Stats.Numos.Value + 100 --Put code here end end end PurchaseHistory:SetAsync(playerProductKey, true) return Enum.ProductPurchaseDecision.PurchaseGranted end |
|
|
| Report Abuse |
|
|
|
| 30 May 2014 07:41 PM |
You never defined player
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
| |
|
|
| 30 May 2014 07:46 PM |
Put this at the very tippy top of the LOCALscript:
p = game.Players.LocalPlayer
And then replace this line: MarketplaceService:PromptProductPurchase(player, productId)
with this: MarketplaceService:PromptProductPurchase(p, productId)
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
yurhomi10
|
  |
| Joined: 10 Dec 2008 |
| Total Posts: 13886 |
|
|
| 30 May 2014 07:47 PM |
@vyx
next time you shouldn't be rude to people helping because it will bite back. |
|
|
| Report Abuse |
|
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
|
| 30 May 2014 08:04 PM |
I dont think the problem is defining the player because usually when something isnt defined it says:
"Attempt to index global(or local) 'Player' a nil value."
but it says:
"player should be of type Player, but is of type nil."
thats not the same thing is it? |
|
|
| Report Abuse |
|
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
| |
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
|
| 30 May 2014 08:21 PM |
Ok i tried what you said with the local player and now i get an error on line 11 saying:
"Can only register ProcessReceipt callback on server."
so i guess local script wont work. |
|
|
| Report Abuse |
|
|
|
| 30 May 2014 08:24 PM |
Nononononono
.ProcessReceipt should go in a normal script located in ServerScriptService. |
|
|
| Report Abuse |
|
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
|
| 30 May 2014 08:34 PM |
| eye eye eye this is so confusing! ive been at this for hours. |
|
|
| Report Abuse |
|
|