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

Why does the DevProduct script work perfect in studio but not AT ALL in game?

Asked by 5 years ago
Edited 5 years ago

So this super weird problem I have with this is that there is no errors at all and it doesn't give the player the money basically scamming them. Can anyone help me fix this, it works perfectly in studio.

local mps = game:GetService("MarketplaceService") 
local ten = 457728758
local twentyfive = 457733655
local fifty = 457733930
local hundred = 457735038
local twofifty = 457739950
local thousand = 457740093
function mps.ProcessReceipt(receiptInfo)
    local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
    if not player then
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
    if receiptInfo.ProductId == ten then
        local stats = player.leaderstats.IslandBux
        stats.Value = stats.Value + 10
    end
    if receiptInfo.ProductId == twentyfive then
        local stats = player.leaderstats.IslandBux
        stats.Value = stats.Value + 25
    end
    if receiptInfo.ProductId == fifty then
        local stats = player.leaderstats.IslandBux
        stats.Value = stats.Value + 50
    end
    if receiptInfo.ProductId == hundred then
        local stats = player.leaderstats.IslandBux
        stats.Value = stats.Value + 100
    end
    if receiptInfo.ProductId == twofifty then
        local stats = player.leaderstats.IslandBux
        stats.Value = stats.Value + 250
    end
    if receiptInfo.ProductId == thousand then
        local stats = player.leaderstats.IslandBux
        stats.Value = stats.Value + 1000
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted 
end
--mps.ProcessReceipt = mps.ProcessReceipt
0
Are you doing this from a LocalScript? You can't change leaderboard stats from the client. TerrodactyI 173 — 5y
0
No it's in the ServerScriptService. VECTORGRAPHIC 5 — 5y
0
You can charge players from the server side? Please give all of the relevant code. TerrodactyI 173 — 5y
0
It's being charged from the clients GUI. VECTORGRAPHIC 5 — 5y

Answer this question