The pictures explain most of it... First Picture (Lightshot), Second Picture (Also Lightshot), Third Picture (Yet Again, Lightshot)
So I really need help figuring out why I receive a random number of M1911's when I purchase the Developer Product.
+Rep to anyone who helps me, with logical/working answers.
If you don't feel like looking at the pictures (even though they explain everything better...),
Here is the LocalScript inside StarterPack:
local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton local damageButton = game.Workspace.DamageButton.SurfaceGui.TextButton local productId = 19635648 buyButton.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId) end) damageButton.MouseButton1Click:connect(function() game.Players.LocalPlayer.Character.Humanoid.Health = game.Players.LocalPlayer.Character.Humanoid.Health - 40 end)
Here is the Script inside Workspace.BuyButton:
local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local productId = 19635648 MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == productId then game.Lighting:FindFirstChild("M1911"):Clone().Parent = player.Backpack game.Workspace.DisplayScreen.SurfaceGui.TextBox.Text = player.Name .. " has purchased an illegal M1911." wait(2) weapons = game.Lighting:FindFirstChild("M1911") local c = game.Players:FindFirstChild(player.Name).Backpack:GetChildren() for i = 1,#c do if c[i].Name ~= "M1911" then for i = 1, #weapons do if weapons[i].className == "Tool" then weapons[i]:clone().Parent = player.Backpack end end end end end end end local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId ds:IncrementAsync(playerProductKey, 1) return Enum.ProductPurchaseDecision.PurchaseGranted end
I don't have time to thoroughly look through this but I think I see where the issue is... I think line 15-26 is your issue
weapons = game.Lighting:FindFirstChild("M1911") local c = game.Players:FindFirstChild(player.Name).Backpack:GetChildren()--okay so you look in the players backpack for i = 1,#c do --check all the items if c[i].Name ~= "M1911" then--find items in the back that are m1911 for i = 1, #weapons do --so for every m1911 model you copy a tool if weapons[i].className == "Tool" then weapons[i]:clone().Parent = player.Backpack--this will eventually add up to a lot end end end
Look in that area for your issue. I'll look more into this in a few minutes. Playing League of Legends atm... lol