Developer Product Doesnt work

when i press buy its make my Lives Lower but in the script its doing +“Amount”
where is my mistake + its dosent print any errors

local MarketplaceService = game:GetService(“MarketplaceService”)

local function processReceipt(receiptInfo)

local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
	return Enum.ProductPurchaseDecision.NotProcessedYet
end
game.Players:GetPlayerByUserId(receiptInfo.PlayerId).leaderstats.Lives.Value = game.Players:GetPlayerByUserId(receiptInfo.PlayerId).leaderstats.Lives.Value + 15


return Enum.ProductPurchaseDecision.PurchaseGranted

end

MarketplaceService.ProcessReceipt = processReceipt

image

1 Like

Are you sure you haven’t got any overriding ProcessReceipt handlers?

Remember that this is a callback, not an event, meaning whatever function you assign it to last is the one that runs.

no i dident get any ProcessReceipt handlers

So the script you showed us is the only ProcessReceipt callback you assign it to?

Also, you should use the code formatting instead of posting screenshots. It’s harder to read and analyze your code if it’s a screenshot.

i did it now i really dont know what do why ITS DOING LOWER LIVES NOT MORE

local MarketplaceService = game:GetService(“MarketplaceService”)

local function processReceipt(receiptInfo)

local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
	return Enum.ProductPurchaseDecision.NotProcessedYet
end
game.Players:GetPlayerByUserId(receiptInfo.PlayerId).leaderstats.Lives.Value = game.Players:GetPlayerByUserId(receiptInfo.PlayerId).leaderstats.Lives.Value + 15


return Enum.ProductPurchaseDecision.PurchaseGranted

end

MarketplaceService.ProcessReceipt = processReceipt

Does this issue reproduce in a separate place?

Try using the same UI, scripts and Dev products in a different place (remember to change the Dev product ID though) and let me know if it happens.

I’m not sure the Lives value lowers to 0 instead of being added 15 like your script is scripted to.

Are you absolutely sure there is no script that could potentially reset the lives or power them to 0?

i will do it now but no script can do it lower lives why because when only player dies its set his live LOWER -1 no other scripts

Could you post your player death script here? That might be the issue. I see no reason for the health to lower other than a script doing that somewhere.

on other game its working but why its not working on that game???

i send the script now

local cashSave = game:GetService(“DataStoreService”):GetDataStore(“Cash”)

game.Players.PlayerAdded:Connect(function(player)
local key = player.UserId
local Folder = Instance.new(“Folder”,player)
Folder.Name = “leaderstats”
local Value = Instance.new(“IntValue”,Folder)
Value.Name = “Lives”
Value.Value = 1
local Cash = Instance.new(“IntValue”,Folder)
Cash.Name = “Points”
Cash.Value = cashSave:GetAsync(key , Cash.Value) or 0
print(“loaded”)

Cash.Changed:Connect(function(player)

 cashSave:SetAsync(key , Cash.Value)
print("Changed")

end)

game.Players.PlayerRemoving:Connect(function(player)

cashSave:SetAsync(key , Cash.Value)
print("Saved")

end)

player.CharacterAdded:Connect(function(character)
	
	local humanoid
	
	
	humanoid = character:FindFirstChild("Humanoid")
	
	if humanoid then
		
		humanoid.Died:Connect(function()
			print("Dead")
			
			local event = game.ReplicatedStorage.Events.Died
		
	local Event = game.ReplicatedStorage.Events.KickPlayer

Event:FireClient(player)

				
			event:FireClient(player)
			
			local eventMessage = game.ReplicatedStorage.Events.DiedMessage
			
			
			eventMessage:FireClient(player)
			

			
		end)
		
	end

end)

end)

game:GetService(“ReplicatedStorage”).Events.Died.OnClientEvent:Connect(function()

game.Players.LocalPlayer:FindFirstChild("leaderstats").Lives.Value = game.Players.LocalPlayer:FindFirstChild("leaderstats").Lives.Value -1

end)

can you go discord???

i will call you and we try fix it??

you can?

Not at the moment, I’m on mobile. You could PM me your tag so we can try fixing it by text there though.

Try setting your Lives number to 100 in studio debug mode before purchasing your product. Let me know what the value changes to.

i did it i put 100 and when i bought its make my lives 0

Use the Find in all scripts tool and check for the following: Lives.Value = 0

Let me know if it pops any results. (and if it does, paste the script here)

After i die FIrst time its only work

Did you run the search…?

I need to know if any scripts are resetting it.

whats Run Search?

no script resetting

how i need fix it ? idk whats the reason its WORKING only when player Dies First Time