Dev Product Not Working

local MarketPlace = game:GetService(“MarketplaceService”)

Server:
MarketPlace.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1148820865 then
		local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		local Tank = game.ReplicatedStorage.TankSpawn.Tank:Clone()
		Tank.Parent = game.Workspace.Cars
		plr.Character.Humanoid.MaxHealth = 101
		plr.Character.Humanoid.Health = 101
		for i,v in pairs (game.Players:GetChildren()) do
			v.Character.Humanoid.Health -= 100
		end
		plr.Character.Humanoid.Health = 100
		plr.Character.Humanoid.MaxHealth = 100
		
		spawn(function()-- create a new thread so wait(7) doesnt interupt anything else in the script
			wait(7)
			Tank:Destroy()
		end)
		return Enum.ProductPurchaseDecision.PurchaseGranted
	else
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
end 

LocalScript: local id = 1146971176
local mps = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer


script.Parent.MouseButton1Click:Connect(function()
	mps:PromptProductPurchase(plr, id)
end)
1 Like

This is just not erroring and not firing. I don’t know what to do.

Both of the id’s match and the dev product DOES in fact exist.

What about it is not working? Please provide context, any error messages and all relevant information needed in the thread itself rather than throwing all your code down and hoping someone does the work for you figuring out what’s wrong and spoonfeeding a solution. Also, try to edit previous responses if you can to include new information rather than cluttering the replies with one-line sentences.

I said its not erroing. Its not saying ANYTHING!

Ok thanks. Yeah but its not erroring at all. Also, im in a big rush so I just kinda needed to send to out.

Try to debug the program by adding prints inside the ProcessReceipt function.

Okay. Have you done any debugging on this code then? For example, simply putting print statements around your code to check what is and isn’t running. You should also be doing debugging too, not just relying on error messages to show what’s not working.

Ok. I will try but nothing with print most likley.


MarketPlace.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1148820865 then
		print("Starts")
		local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		print("GetsPlayer")
		local Tank = game.ReplicatedStorage.TankSpawn.Tank:Clone()
		Tank.Parent = game.Workspace.Cars
		print("ClonesTank")
		plr.Character.Humanoid.MaxHealth = 101
		plr.Character.Humanoid.Health = 101
		for i,v in pairs (game.Players:GetChildren()) do
			v.Character.Humanoid.Health -= 100
		end
		plr.Character.Humanoid.Health = 100
		plr.Character.Humanoid.MaxHealth = 100
		print("KillsEveryoneElse")
		spawn(function()-- create a new thread so wait(7) doesnt interupt anything else in the script
			wait(7)
			Tank:Destroy()
			print("DestroysTank")
		end)
		return Enum.ProductPurchaseDecision.PurchaseGranted
	else
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
end

The ID on the server doesn’t match up with the client. I can tell from your responses here, that you’ve done minimal work to debug your program.

Please first work through your program, diagnose what the problem is exactly and provide thorough context when asking questions here. This issue could’ve been resolved with minimal testing on your part.

2 Likes

They match now, doesn’t work. No prints.

First Script (Server):


MarketPlace.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1146971176 then
		print("Starts")
		local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		print("GetsPlayer")
		local Tank = game.ReplicatedStorage.TankSpawn.Tank:Clone()
		Tank.Parent = game.Workspace.Cars
		print("ClonesTank")
		plr.Character.Humanoid.MaxHealth = 101
		plr.Character.Humanoid.Health = 101
		for i,v in pairs (game.Players:GetChildren()) do
			v.Character.Humanoid.Health -= 100
		end
		plr.Character.Humanoid.Health = 100
		plr.Character.Humanoid.MaxHealth = 100
		print("KillsEveryoneElse")
		spawn(function()-- create a new thread so wait(7) doesnt interupt anything else in the script
			wait(7)
			Tank:Destroy()
			print("DestroysTank")
		end)
		return Enum.ProductPurchaseDecision.PurchaseGranted
	else
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
end

Script Two: Under Button

local id = 1146971176
local mps = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer


script.Parent.MouseButton1Click:Connect(function()
	mps:PromptProductPurchase(plr, id)
end)

Do you have any other script that sets the ProcessReceipt function? You can only have one script for ProcessReceipt

1 Like

Ik its only one. Ill even check again.

Do CTRL SHIFT F to filter through all scripts for ProcessReceipt

OMG MY PREVIOS SCRIPTER ADDED ONE IN! XD THNAK YOU SO MUCH! You don’t even understand. Now to yell at my other scripter lol.

1 Like

Please spend a bit more time rifling through all your code and debugging. All this could have been solved very quickly if you provided details from the start and if you had checked your own code first before posting to the forum. Also, again, the DevForum isn’t an IM like Discord, please try and condense your replies into as little posts as possible.

1 Like