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

Purchase Script Giving Wrong Tool?! Button Gives Wrong Tool? [solved]

Asked by 4 years ago
Edited by Shawnyg 4 years ago

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
Ah, I see what I did wrong! Jomeliter 55 — 4y

Answer this question