This is my button script:
1 | local player = game.Players.LocalPlayer |
2 | local Market = game:GetService( "MarketplaceService" ) |
3 | id = 984081930 |
4 |
5 | script.Parent.MouseButton 1 Click:Connect( function () |
6 | Market:PromptProductPurchase(player,id) |
7 | end ) |
This is my serverscript:
01 | local Market = game:GetService( "MarketplaceService" ) |
02 |
03 | Market.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 |
12 | end |
It doesn't seem to change the Value.
I guess heres a fixed serverscript?
01 | local MarketplaceService = Game:GetService( "MarketplaceService" ) |
02 |
03 | local P 1 = 984081930 |
04 |
05 | MarketplaceService.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 = = P 1 then |
11 | game.Workspace.InvincibilityActivated.Value = false |
12 | print ( "Activated!" ) |
13 | wait( 30 ) |
14 | game.Workspace.InvincibilityActivated.Value = true |
15 | print ( "Expired" ) |