Ad
Log in to vote
0

Why is the title just this? [2]

Asked by
c0des 207 Moderation Voter
8 years ago

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

1 answer

Log in to vote
2
Answered by
Dummiez 360 Moderation Voter
8 years ago

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

0
Thank you very much. c0des 207 — 8y
Ad

Answer this question