Hello! I was creating a developer product script. One of the products sells the option to skip a stage (it works well), while the other is the kill all function, which I’m having a hard time getting to work.
Does anyone know how I can fix this? Thanks!
function processReceipt(info)
local plr = game:GetService("Players"):GetPlayerByUserId(info.PlayerId)
if plr then
if info.ProductId == 2636822786 then
plr.Character.Humanoid.Health = 0
local stats = plr:WaitForChild("leaderstats")
local changeStage = stats and stats:FindFirstChild("Stage")
if changeStage then
changeStage.Value +=1
game.Workspace.SoundEffects.LevelUp:Play(plr)
end
elseif info.ProductId == 2651471576 then
local playa = game.Players:GetPlayerByUserId(info.PlayerId)
for i, playa in ipairs(game.Players:GetChildren()) do
if playa ~= playa then
playa.Character.Humanoid.Health = 0
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
else
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
game:GetService("MarketplaceService").ProcessReceipt = processReceipt