This is my button script:
local player = game.Players.LocalPlayer local Market = game:GetService("MarketplaceService") id = 984081930 script.Parent.MouseButton1Click:Connect(function() Market:PromptProductPurchase(player,id) end)
This is my serverscript:
local Market = game:GetService("MarketplaceService") Market.ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == "984081930" then game.Workspace.InvincibilityActivated.Value = false print("Activated!") wait(30) game.Workspace.InvincibilityActivated.Value = true print("Expired") return Enum.ProductPurchaseDecision.PurchaseGranted end end
It doesn't seem to change the Value.
I guess heres a fixed serverscript?
local MarketplaceService = Game:GetService("MarketplaceService") local P1 = 984081930 MarketplaceService.ProcessReceipt = function(receiptInfo) local Player = Game.Players:GetChildren() for i = 1, #Player do if Player[i].userId == receiptInfo.PlayerId then prodId = tonumber(receiptInfo.ProductId) if prodId == P1 then game.Workspace.InvincibilityActivated.Value = false print("Activated!") wait(30) game.Workspace.InvincibilityActivated.Value = true print("Expired") else --Error end end end return Enum.ProductPurchaseDecision.PurchaseGranted end