DevProductPurchase working on local game file but not on Roblox game file

As the title says, my rbxl file is working. But, the Roblox save file doesn’t.
Here’s my script.

-- ServerScript

local MarketplaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local ProdID = 1235535323

local function processReceipt(receiptInfo)
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	if player then
		game:GetService("ReplicatedStorage"):WaitForChild("Revive"):FireClient(player)
		print("yuh yuh yuh")
	end
	
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

MarketplaceService.ProcessReceipt = processReceipt
--Local Script
local placeToTeleportTo = CFrame.new(game:GetService("Workspace"):WaitForChild("ReviveSpawn").Position)
local Players = game:GetService("Players")
local player = Players.LocalPlayer

local function Revive()
	local Character = player.Character or player.CharacterAdded:Wait()
	Character:PivotTo(placeToTeleportTo)
	player.Character:FindFirstChild("HumanoidRootPart").Anchored = false
	player.PlayerGui:FindFirstChild("Died"):Destroy()
	game:GetService("Lighting").Blur.Enabled = false
	player.PlayerGui:WaitForChild("Health").Enabled = true
end

game:GetService("ReplicatedStorage"):WaitForChild("Revive").OnClientEvent:Connect(Revive)

I’ve never seen anyone else having issues with this. I’m experiencing the same problem on other games, aswell.

1 Like

What are you trying to achieve?

What’s failing?

I need to know that so I can help you-

1 Like

Thanks for the response.
The revive button doesn’t work. As you can see I’m printing “yuh yuh yuh” on the server script; this does not print.
However, on the rbxl file everything is working perfectly.

I’m trying to make it work on the public game file.

1 Like

Hello there. Could you possibly provide us with the output? Did you receive any errors? You said that it worked on the local game and not the Roblox one, but what do you mean by local. Do you mean the Studio Version that is saved locally on your PC, the Studio Version published to Roblox, or the actual Roblox game itself? Thank you.

By the local game I mean’t the game that is saved on your computer.

It doesn’t say anything on the non-locally-saved version. However on the locally saved version it prints “yuh yuh yuh” as you can see on line 16.

Are you sure that the product exists?

image
if it didn’t exist it wouldnt be working on the local file

I recommend you test it in Studio and debug the purchase function. Either use print statements or the debugger. Check to see what line the code stops executing in order to find the cause of the problem.

1 Like

Do you have the Roblox API option enabled? Not really sure but it might be the cause

Already tried this. It has no effect

You know, it might have something to do with this local script:

local t = 15; --how long does it take to go through the rainbow

local tick = tick
local fromHSV = Color3.fromHSV
local RunService = game:GetService("RunService")
local Frame = script.Parent

local Button = Frame:WaitForChild("Button")

RunService:BindToRenderStep("Rainbow", 1000, function()
	local hue = tick() % t / t
	local color = fromHSV(hue, 1, 1)
	Frame.BackgroundColor3 = color
end)

Button.MouseButton1Down:Connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, 1235535323)
end)

This is the purchase button script. cause it doesn’t even seem that the server script is getting activated.

I tried your script in studio and it printed it on me, can you try the game by publishing and playing?
image

I might be wrong, but isn’t PromptProductPurchase a server functions? Shouldn’t it be fired on the server?

Did you load it on the local file? Or the server file? Also, try doing that in a public game.

The game is public and I already tried it in a public game.

It’s a privated game. I also promped the purchase through a server script.

Is it? I didn’t know. Do you know how to prompt a dev product purchase on a local script?

Use RemoteEvents to fire an event that will invoke the purchase.

1 Like

Try reloading the game through the public file.

Alright, I’ll try that, thanks.
Can I have a code example please. I’m still learning remote events.

--server
remoteEvent.OnServerEvent:Connect(function(player)
    game:GetService("MarketplaceService"):PromptProductPurchase(player, 1235535323)
end
--client
remoteEvent:FireServer()

I didn’t test, lmk if there are any errors.

1 Like