I've been trying to get my TextButton to purchase another Tool when clicked, but whenever you buy it, it gives you the other Tool?

If you buy the "Milkshake" You're given the Fries instead.

But if you buy the Fries you get the Fries?

Fries Script

local MPS = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local Folder = RS:WaitForChild("Tools")
local Fries = Folder:FindFirstChild("FrenchFries")
local productID = 949968105

local function processReceipt(receiptInfo)
	
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	if player then
		local char = game.Workspace:FindFirstChild(player.Name)
		local FriesClone = Fries:Clone()
		FriesClone.Name = "Fries"
		print("Fries Given!")
		FriesClone.Parent = char
	end
	
	return Enum.ProductPurchaseDecision.PurchaseGranted
	
	
end

MPS.ProcessReceipt = processReceipt

Milkshake Script

local MPS = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local Folder = RS:WaitForChild("Tools")
local Milk = Folder:FindFirstChild("Milkshake")
local productID = 950033959

local function processReceipt(receiptInfo)
	
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	if player then
		local char = game.Workspace:FindFirstChild(player.Name)
		local MilkshakeClone = Milk:Clone()
		MilkshakeClone.Name = "Milkshake"
		print("MilkShake Given!")
		MilkshakeClone.Parent = char
	end
	
	return Enum.ProductPurchaseDecision.PurchaseGranted
	
	
end

MPS.ProcessReceipt = processReceipt

1 comment

1

Ah, I see what I did wrong!