Hello, this is one of my first times working with marketplaceservice and I just want to make sure everything inside this revive script is good.
https://gyazo.com/cb2d8d53ab83ec7757d0e72c1913b33b
Local Script
local product = 965729418
local MarketPlace = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer
game.ReplicatedStorage.ReviveRemote.OnClientEvent:Connect(function()
script.Parent.Parent.Enabled = true
script.Parent.Revive.MouseButton1Click:Connect(function()
--They clicked on the revive button
MarketPlace:PromptProductPurchase(plr,product)
end)
script.Parent.LobbyReturn.MouseButton1Click:Connect(function()
--They clicked on the return to lobby button
game:GetService("TeleportService"):Teleport(4588193960,plr)
end)
local Timer = 30
repeat
wait(1)
Timer = Timer - 1
script.Parent.Counter.Text = Timer
if script.Parent.Parent.Enabled == false then
-- if the parent isn't enabled that means they bought the developer product
return
end
until Timer == 0
--if the timer reaches zero without returning then we're gonna teleport the player
game:GetService("TeleportService"):Teleport(4588193960,plr)
end)
game.ReplicatedStorage.DeathScreenDisable.OnClientEvent:Connect(function()
script.Parent.Parent.Enabled = false
end)
Script in serverscript service
local MarketPlace = game:GetService("MarketplaceService")
local product = 965729418
MarketPlace.ProcessReceipt = function(purchaseInfo)
local plr = game.Players:GetPlayerByUserId(purchaseInfo.PlayerId)
if purchaseInfo.ProductId == product then
--Load The Character and disable the playerGui
plr:LoadCharacter()
game.ReplicatedStorage.DeathScreenDisable:FireClient(plr)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Thanks!