Currency shop working in studio but not in normal roblox server

  1. I want to make an currency shop so when you click the button, you get a prompt and if you buy it, you have money

  2. The issue is that it’s only working in studio and not in normal server (server with people)
    here is some script :
    (main script in workspace )

local MPS = game:GetService("MarketplaceService")
local CurrencyName = "$"

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1292569051 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats[CurrencyName].Value = player.leaderstats[CurrencyName].Value + 5000
		return Enum.ProductPurchaseDecision.PurchaseGranted
		
	elseif receiptInfo.ProductId == 1301067700 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats[CurrencyName].Value = player.leaderstats[CurrencyName].Value + 10000
		return Enum.ProductPurchaseDecision.PurchaseGranted
		
	elseif receiptInfo.ProductId == 1315023063 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats[CurrencyName].Value = player.leaderstats[CurrencyName].Value + 50000
		return Enum.ProductPurchaseDecision.PurchaseGranted
	elseif receiptInfo.ProductId == 1315023639 then 
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats[CurrencyName].Value = player.leaderstats[CurrencyName].Value + 100000
		return Enum.ProductPurchaseDecision.PurchaseGranted
	elseif receiptInfo.ProductId == 1315024011 then 
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats[CurrencyName].Value = player.leaderstats[CurrencyName].Value + 500000
		return Enum.ProductPurchaseDecision.PurchaseGranted
	elseif receiptInfo.ProductId == 1315024360 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats[CurrencyName].Value = player.leaderstats[CurrencyName].Value + 1000000
		return Enum.ProductPurchaseDecision.PurchaseGranted
	
	end
end

and this is the local script of the button


MPS = game:GetService("MarketplaceService")
id = 1292569051 -- replace with your ID
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
	MPS:PromptProductPurchase(player, id)
end)
  1. i don’t find anything about this on the devforum :confused:

Can somebody help me please ! thanks

did you enable third party purchases in the games settings?

1 Like

yeah i did it before

Character limit (ignore)

for the characters limit i put this text

Do you have a Remote Event setup that prompts the Server script to process the receipt? You will need to communicate from the client to the server in order to call this function.

Roblox Client-Server Model
Remote Functions and Events

oh ok, i wasn’t sure to use it because it was working on studio so i was thinking i don’t need it

This may have been working on Studio because Roblox Studio does not handle purchases directly and allows you to test any purchase without actually making the transaction.

1 Like