I have this script, which just adds a value onto their data when you purchase a dev product, but for some reason, the script only works inside of Studio, and not inside an actual game.
I’ve tried a few different methods of fixing this that I read on other posts, but none of which seem to have worked, if you know please inform me.
Script:
local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Products = require(ReplicatedStorage:WaitForChild("Products"))
local SkipProduct = Products.ProductIds.Skip
local RebirthProduct = Products.ProductIds.Rebirth
local function processReceipt(recepitInfo)
local player = game.Players:GetPlayerByUserId(recepitInfo.PlayerId)
if player then
local id = recepitInfo.ProductId
if id == SkipProduct then
player.Data.Skip.Value += 1
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if id == RebirthProduct then
player.leaderstats.Stage.Value = 1
player.leaderstats.Rebirth.Value += 1
task.wait(1)
player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
else
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
MarketplaceService.ProcessReceipt = processReceipt
Are there any other ProcessReceipt events in any other script in the game? There can only be one ProcessReceipt callback in the game, if there’s multiple, only one of them will run, which might be the case here.
Make sure you used ctrl + shift + f to search all scripts properly
Anyways, have you tried print debugging to see if the script runs properly and reaches the event?
Yeah I already used control + shift + f, there’s only one. I tried the print debugging, but as expected, it all works perfectly fine in studio, but when it comes to an actual game, it seems that the process receipt doesn’t even fire.