Hi, I'm trying to make a script so that if they buy a dev product they get a coil, but if they die, they get the coil again. No matter what I do I can't get it to award the coil when they die. I don't want to use a game pass though.
local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local productID = 1006378151
local function processReceipt (receiptInfo)
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
--notg
--reee
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
game.ServerStorage.cool:clone().Parent = player.Backpack ---Award it as soon as they buy it.
while true do ---A while true loop to check if they are dead.
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = processReceipt
If you could help me out, please do.

2 comments
Where is the script located inside of?
use Humanoid.Died