Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is the title just this? [2]

Because Yolo. That's why. Why else? I mean really, why else?

1 answer

✓ Accepted answer

Added an if not statement to check if that tool is already in the Backpack. That way it will prevent the player from having multiple copies of Obitor.. or whatever that is lol.

local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 19645570

MarketplaceService.ProcessReceipt = function(receiptInfo) 

    for i, player in ipairs(game.Players:GetChildren()) do

        if player.userId == receiptInfo.PlayerId then

            if receiptInfo.ProductId == productId then
				if not player.Backpack:findFirstChild("Obitor") then
                game.Lighting:FindFirstChild("Obitor"):Clone().Parent = player.Backpack
                game.Workspace.DisplayScreen.SurfaceGui.TextBox.Text = player.Name .. " has purchased an illegal Obitor."
				end
        end
    end
end
    local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
    ds:IncrementAsync(playerProductKey, 1)  

    return Enum.ProductPurchaseDecision.PurchaseGranted
end

1 comment

0

Thank you very much.

This discussion is preserved as it was. New answers, comments, and votes are closed.