Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

What is wrong?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

The cash works fine but when it needs gives gear it doesn't work. What is wrong?

1 elseif receiptInfo.ProductId == GearEen then 2 game.Lighting.GravityCoil:Clone().Parent=player.Backpack 3 end ^^^^^^ I think the problem is here..

view source 01 local MarketplaceService = Game:GetService("MarketplaceService") 02 local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") 03 local thousandCash = 23194788 --Put the ID for the thousand cash buy 04 local five_hundredCash = 23194787 --ID for 500 cash buy 05 local five_thousandCash = 23216025 --ID for 500 cash buy 06 local GearEen = 25553578 --ID for Gear 07

08 MarketplaceService.ProcessReceipt = function(receiptInfo) 09 local playerProductKey = "player_" .. receiptInfo.PlayerId .. "product" .. receiptInfo.ProductId 10 local numberBought = ds:IncrementAsync(playerProductKey, 1) 11 for i,v in pairs (game.Players:GetChildren()) do 12 if v.userId == receiptInfo.PlayerId then 13 if receiptInfo.ProductId == five_hundredCash then 14 local stat = v.leaderstats:FindFirstChild("Cash") 15 if stat ~= nil then 16 stat.Value = stat.Value + 500 17 end 18 elseif receiptInfo.ProductId == thousandCash then 19 local stat = v.leaderstats:FindFirstChild("EggsCandy") 20 if stat ~= nil then 21 while true do 22 stat.Value = stat.Value + 550 23 wait (5) 24 end 25 end 26 elseif receiptInfo.ProductId == five_thousandCash then 27 local stat = v.leaderstats:FindFirstChild("EggsCandy") 28 if stat ~= nil then 29 stat.Value = stat.Value + 500 30 end 31 elseif receiptInfo.ProductId == GearEen then 32 game.Lighting.GravityCoil:Clone().Parent=player.Backpack 33 end 34 end 35 end 36 return Enum.ProductPurchaseDecision.PurchaseGranted 37 end

1 answer

Log in to vote
0
Answered by 8 years ago

I Believe In order for elseif there needs to be an if. so replace the else if with if like so

if receiptInfo.ProductId == GearEen then
 game.Lighting.GravityCoil:Clone().Parent=player.Backpack
end

Hope this helps!

Ad

Answer this question