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

Value doesn't change after buying Developer Product?

Asked by 4 years ago

This is my button script:

1local player = game.Players.LocalPlayer
2local Market = game:GetService("MarketplaceService")
3id = 984081930
4 
5script.Parent.MouseButton1Click:Connect(function()
6    Market:PromptProductPurchase(player,id)
7end)

This is my serverscript:

01local Market = game:GetService("MarketplaceService")
02 
03Market.ProcessReceipt = function(receiptInfo)
04    if receiptInfo.ProductId == "984081930" then
05        game.Workspace.InvincibilityActivated.Value = false
06        print("Activated!")
07        wait(30)
08        game.Workspace.InvincibilityActivated.Value = true
09        print("Expired")
10        return Enum.ProductPurchaseDecision.PurchaseGranted
11    end
12end

It doesn't seem to change the Value.

1 answer

Log in to vote
0
Answered by
Lakodex 711 Moderation Voter
4 years ago

I guess heres a fixed serverscript?

01local MarketplaceService = Game:GetService("MarketplaceService")
02 
03local P1 = 984081930
04 
05MarketplaceService.ProcessReceipt = function(receiptInfo)
06    local Player = Game.Players:GetChildren()
07    for i = 1, #Player do
08        if Player[i].userId == receiptInfo.PlayerId then
09            prodId = tonumber(receiptInfo.ProductId)
10            if prodId == P1 then
11                game.Workspace.InvincibilityActivated.Value = false
12                    print("Activated!")
13                    wait(30)
14                    game.Workspace.InvincibilityActivated.Value = true
15                    print("Expired")
View all 23 lines...
0
Could you give me an explanation? CrypxticDoge 135 — 4y
0
Not very good at that. Lakodex 711 — 4y
Ad

Answer this question