ProximityPrompts - Snowballs

Hey! So I’m trying to create a thing in my game, where when someone purchases the developer product (in-game) it gives them snowballs in return. My code right now is:

       local id = DEVELOPERPRODUCTID
       local tool = workspace.ServerStorage
		local MarketplaceService = game:GetService("MarketplaceService")
		game:GetService("MarketplaceService"):PromptProductPurchase(plr, id)
		MarketplaceService.PromptProductPurchaseFinished:Connect(function(userId, productId, value)
			if userId == plr.UserId and id == productId and value then 
           tool.Parent = player:WaitForChild("Backpack")
         return true
		 return Enum.ProductPurchaseDecision.PurchaseGranted

			end
		end)
end)```

Does anyone know if this would work?

Is this in a server script, or a local script?

Local Script, im not sure if it should go in server script tho so like.

Can you try making it in a server script?

Okay, i’ll try it out, does the code look like it should work though?

I think, although I don’t understand what value is. (value in this line MarketplaceService.PromptProductPurchaseFinished:Connect(function(userId, productId, value))

Depends weather this is in server script service or not. I Think there’s one to many ends too

1 Like

Yes the last end) isn’t needed

1 Like

You should be using ProcessReceipt as PromptProductPurchaseFinished is depreciated. You can prompt the purchase from the server or the client, but verify the purchases on the server.

3 Likes

That was the one I was thinking about anyways

1 Like