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

Developer products; output error "Studio API access is not enabled"?

Asked by 8 years ago

Does that mean that my game must have save features in order to use developer products?

My script is located inside of a StartMenu Gui, and localscript.

Player = game.Players.LocalPlayer
Menu = script.Parent
Play = Menu.Play
Pack1 = Menu.Pack1
Pack2 = Menu.Pack2

function PlayGame()
    Menu:remove()
end
Play.MouseButton1Down:connect(PlayGame)

function Buy1()
    --LocalScript in StarterPack
-- setup local variables
local buyButton = Pack1
local productId = 20518668

-- when player clicks on buy brick prompt him/her to buy a product
buyButton.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)




--Script in BuyButton part
-- setup local variables
local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 32819339

-- define function that will be called when purchase finished
MarketplaceService.ProcessReceipt = function(receiptInfo) 

    -- find the player based on the PlayerId in receiptInfo
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then


            -- check which product was purchased
            if receiptInfo.ProductId == productId then

                -- handle purchase
                player.leaderstats.Money.Value = player.leaderstats.Cash.Value + 1000000
            end
        end
    end 

    -- record the transaction in a Data Store
    local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
    ds:IncrementAsync(playerProductKey, 1)  

    -- tell ROBLOX that we have successfully handled the transaction
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end
end
Pack1.MouseButton1Down:connect(Buy1)
1
Game page -> ... -> Configure this Game -> Enable Studio Access to API Services funyun 958 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago

The answer isn't in studio, confusing eh? First go to the Develop page. Then click on the game, not place, but game. Then go to Basic Settings>Enable Studio Access to API Services, then click it on.

Example Image, click here.

0
Will this enable people to copy my place though? Tradesmark 65 — 8y
0
No, that's only if you un-copylock the place, which you're not doing. funyun 958 — 8y
0
^ JamesLWalker 297 — 8y
0
Awesome. Thanks a bunch guys! Tradesmark 65 — 8y
Ad

Answer this question