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 » Game Design
Home Search
 

Re: Can anyone help me fix this?

Previous Thread :: Next Thread 
ArceusLevelX is not online. ArceusLevelX
Joined: 16 Apr 2013
Total Posts: 762
15 Jan 2015 08:46 PM
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

local CASHID = 20808154
local CASHID1 = 20808158
local CASHID2 = 20808166
local CASHID3 = 20808169
local CASHID4 = 20808175
local CASHID5 = 22334240
local CASHID6 = 22334242
MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = ds:IncrementAsync(playerProductKey, 1)
for i,v in pairs (game.Players:GetChildren()) do
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == CASHID then


local lds = v:FindFirstChild("leaderstats")
if lds ~= nil then
local cs = lds:FindFirstChild("Lives")
if cs ~= nil then
cs.Value = cs.Value + 10
elseif receiptInfo.ProductId == CASHID1 then
local lds = v:FindFirstChild("leaderstats")
if lds ~= nil then
local cs = lds:FindFirstChild("Lives")
if cs ~= nil then
cs.Value = cs.Value + 50
elseif receiptInfo.ProductId == CASHID2 then
local lds = v:FindFirstChild("leaderstats")
if lds ~= nil then
local cs = lds:FindFirstChild("Lives")
if cs ~= nil then
cs.Value = cs.Value + 100
elseif receiptInfo.ProductId == CASHID3 then
local lds = v:FindFirstChild("leaderstats")
if lds ~= nil then
local cs = lds:FindFirstChild("Lives")
if cs ~= nil then
cs.Value = cs.Value + 500
elseif receiptInfo.ProductId == CASHID4 then
game.Workspace.Script.Disabled = true
elseif receiptInfo.ProductId == CASHID5 then
local lds = v:FindFirstChild("leaderstats")
if lds ~= nil then
local cs = lds:FindFirstChild("Stage")
if cs ~= nil then
cs.Value = cs.Value + 5
elseif receiptInfo.ProductId == CASHID6 then
local lds = v:FindFirstChild("leaderstats")
if lds ~= nil then
local cs = lds:FindFirstChild("Stage")
if cs ~= nil then
cs.Value = cs.Value + 10
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Report Abuse
championbuilder is online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
15 Jan 2015 08:57 PM
That's a lot o if statements in eachother.
Report Abuse
ArceusLevelX is not online. ArceusLevelX
Joined: 16 Apr 2013
Total Posts: 762
15 Jan 2015 09:11 PM
I made it into this but still not working.

local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

local CASHID = 20808154
local CASHID1 = 20808158
local CASHID2 = 20808166
local CASHID3 = 20808169
local CASHID4 = 20808175
local CASHID5 = 22334240
local CASHID6 = 22334242
MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = ds:IncrementAsync(playerProductKey, 1)
for i,v in pairs (game.Players:GetChildren()) do
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == CASHID then


local lds = v:FindFirstChild("leaderstats")
if lds ~= nil then
local cs = lds:FindFirstChild("Lives")
if cs ~= nil then
cs.Value = cs.Value + 10
elseif receiptInfo.ProductId == CASHID1 then
cs.Value = cs.Value + 50
elseif receiptInfo.ProductId == CASHID2 then
cs.Value = cs.Value + 100
elseif receiptInfo.ProductId == CASHID3 then
if cs ~= nil then
cs.Value = cs.Value + 500
elseif receiptInfo.ProductId == CASHID4 then
game.Workspace.Script.Disabled = true
elseif receiptInfo.ProductId == CASHID5 then
lds.Stage.Value = lds.Stage.Value + 10
elseif receiptInfo.ProductId == CASHID6 then
lds.Stage.Value = lds.Stage.Value + 10
end
end
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Report Abuse
ArceusLevelX is not online. ArceusLevelX
Joined: 16 Apr 2013
Total Posts: 762
15 Jan 2015 09:52 PM
Bump.
Report Abuse
ArceusLevelX is not online. ArceusLevelX
Joined: 16 Apr 2013
Total Posts: 762
16 Jan 2015 09:42 PM
No output
Report Abuse
ArceusLevelX is not online. ArceusLevelX
Joined: 16 Apr 2013
Total Posts: 762
16 Jan 2015 09:46 PM
The first part with CASHID works but not any others
Report Abuse
drager980 is online. drager980
Joined: 25 May 2009
Total Posts: 13385
16 Jan 2015 09:53 PM
if theres no ouput
figure out from the fact that one of the values in the second half is == nil.



AND THE TIGER GOES ROAR
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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