Inside ServerScriptStorage (Sword1)
local MarketplaceService = game:GetService("MarketplaceService") local sword1 = 20859896 MarketplaceService.ProcessReceipt = function(receiptInfo) local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == sword1 then local Item1 = game.ReplicatedStorage.Swords.KnightsSword Item1:Clone().Parent = player.Backpack Item1:Clone().Parent = player.StarterGear end end end end
Inside ServerScriptStorage (Sword2)
local MarketplaceService = game:GetService("MarketplaceService") local sword2 = 20859887 MarketplaceService.ProcessReceipt = function(receiptInfo) local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == sword2 then local Item2 = game.ReplicatedStorage.Swords.Katana Item2:Clone().Parent = player.Backpack Item2:Clone().Parent = player.StarterGear end end end end
Inside LocalScript inside TextButton (Sword 1)
local productId = 20859896 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) end)
Inside LocalScript inside TextButton (Sword 2)
local productId = 20859887 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) end)
How come when the player clicks on button one to buy the sword they get the KnightsSword, but when they click the sword2 button they get the KnightsSword instead of Katana? I have it so when you buy it checks to see which one you brought to give the sword but it isnt working. Please help