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
 

Please Help!

Previous Thread :: Next Thread 
uglypoe is not online. uglypoe
Joined: 26 Mar 2011
Total Posts: 4382
11 Jul 2014 08:39 PM
This is a script inside of a textbutton. What I want is for, when you click the textbutton, for a developer product prompt to show up, but it doesn't seem to. The in-game developer console says "MarketplaceService:PromptProductPurchase() player should be of type Player, but is of type nil".


local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 20394594
local Buy = script.Parent


Buy.MouseButton1Down:connect(function(PromptProductPurchase)
MarketplaceService:PromptProductPurchase(player, productId)
end)

MarketplaceService.ProcessReceipt = function(receiptInfo)

for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then

if receiptInfo.ProductId == productId then

player:findFirstChild("Stats").Credits.Value = player:findFirstChild("Stats").Credits.Value + 10

end
end
end

local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 1)

return Enum.ProductPurchaseDecision.PurchaseGranted
end
Report Abuse
uglypoe is not online. uglypoe
Joined: 26 Mar 2011
Total Posts: 4382
13 Jul 2014 07:56 PM
Bump
Report Abuse
uglypoe is not online. uglypoe
Joined: 26 Mar 2011
Total Posts: 4382
14 Jul 2014 06:51 PM
Bermp
Report Abuse
VisualGraphics is not online. VisualGraphics
Joined: 26 Nov 2010
Total Posts: 6515
14 Jul 2014 06:59 PM
local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 20394594
local player = game.Players.LocalPlayer -- maybe?
local Buy = script.Parent


Buy.MouseButton1Click:connect(function()
MarketplaceService:PromptProductPurchase(player, productId)
end)

MarketplaceService.ProcessReceipt = function(receiptInfo)

for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then

if receiptInfo.ProductId == productId then

player:findFirstChild("Stats").Credits.Value = player:findFirstChild("Stats").Credits.Value + 10

end
end
end

local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 1)

return Enum.ProductPurchaseDecision.PurchaseGranted
end
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