Hello,
I am currently trying to make a pay to re-spawn script for my horror game. However, i'm having a lot of difficulty.
What is meant to happen is when you die, you would get prompted a message asking if you would like to re-spawn for a sum of ROBUX through DevProducts and if you do not decide to re-spawn, you get teleported back to the start game,
So far I have, But my scripting knowledge todo with DevProducts is confusing.
local mps = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
mps.ProcessReceipt = function(receiptInfo)
for i, player in pairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == 629857448 then
print("yay")
else
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
player:Kick("I tried, I tried...")
print("oof")
end)
end)
end
end
end
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
ds:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

2 comments
Why in the world should people have to pay money to respawn? I get this is roblox, but it's not an excuse. -.-
In my opinion, just add a timeout script using tick() to prevent them from respawning for a set amount of time (10min - 1 day)