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 » Scripting Helpers
Home Search
 

Re: Developer Products

Previous Thread :: Next Thread 
Vyxium is not online. 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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
30 May 2014 07:01 PM
This would go in a TextButton

-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::]
Report Abuse
Vyxium is not online. 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 is not online. 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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
30 May 2014 07:18 PM
Where is the server script? You said you got this off the Wiki right?
Report Abuse
Vyxium is not online. 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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
30 May 2014 07:41 PM
You never defined player

-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::]
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
30 May 2014 07:43 PM
I did. With parameters.
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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 is not online. 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 is not online. 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 is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
30 May 2014 08:16 PM
b
Report Abuse
Vyxium is not online. 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
TheAltOfDavid12 is not online. TheAltOfDavid12
Joined: 05 Feb 2014
Total Posts: 352
30 May 2014 08:24 PM
Nononononono

.ProcessReceipt should go in a normal script located in ServerScriptService.
Report Abuse
Vyxium is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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