Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The dev product works in studio test mode but doesn't work in the game. What is the problem?

Asked by 5 years ago

In my game there is a developer product which gives you 1000 cash. It works fine in Roblox Studio test mode, but in the game it doesn't work. In the game it is like a scam or something. Please tell me how to fix this. Here are the scripts:

This script is inside a GUI, it is a local script:

local cash = script.Parent
local id = 438243622

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

This script is in server script service, it is a normal script:

local mservice = game:GetService("MarketplaceService")
local thousandCash = 438243622 --1000 cash

mservice.ProcessReceipt = function(receiptInfo)
    for i, player in pairs(game.Players:GetPlayers()) do
        if player.userId == receiptInfo.PlayerId then
            if receiptInfo.ProductId == thousandCash then
                --give 1000 cash
                player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 1000
            end
        end
    end
end

It works fine in test mode but in the actual game it is like a scam. It takes the robux but doesn't gives the cash. Please tell me how can i fix this.

Thanks!

0
Why are you using a for loop to iterate through the players to check their UserId, when you can use the :GetPlayerByUserId() function? User#24403 69 — 5y

Answer this question