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

DevProduct not working?

Asked by
yurhomi10 192
10 years ago

I don't get anything in the online output, I think I'm not indexing the player right because it's not damaging the player about buying the product. Help?

Server Script

--SET UP VARIABLES--

local MarketPlace = game:GetService("MarketplaceService")
local Datastore = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
DamageID = "19312506"

--------------------


MarketPlace.ProcessReceipt = function(receiptInfo)
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then

            if receiptInfo.ProductId == DamageID then
                player.Character.Humanoid.Health = player.Character.Humanoid.Health - 20
                local m = Instance.new("Message", game.Workspace)
                m.Text = player.Name .. " bought me"
            end
        end
    end
    local productplayerkey = receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
    Datastore:IncrementAsync(productplayerkey, 1)

    return Enum.ProductPurchaseDecision.PurchaseGranted
end

Local Script:

me = game.Players.LocalPlayer
buybutton = game.Workspace:FindFirstChild("BuyMe", true)
DamageID = 19312506

---

buybutton.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(me, DamageID)
end)

1 answer

Log in to vote
1
Answered by
yurhomi10 192
10 years ago

NEVERMIND I GOT IT, I ACCIDENTALLY PUT DAMAGEID AS A STRING. Thanks anwyays guys!!!!!

Ad

Answer this question