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

Why won't this Developer Product script work?

Asked by 9 years ago

Okay, I have two different scripts- A LocalScript in the Textbutton (The script's parent) and a Script in ServerScriptStorage. I have verified that my asset id's are correct. But when I go into the game and click the button, it says the product is no longer for sale, and the product's image isn't the same as my image. Could you please help?

Here is the LocalScript in the button

local MarketplaceService = game:GetService("MarketplaceService")
local Player = game.Players.LocalPlayer
local AssetId = 22106513

script.Parent.MouseButton1Down:connect(function()
    MarketplaceService:PromptPurchase(Player, AssetId)
end)

And here is the Script in ServerScriptStorage

local AssetID = 22106513
local MarketplaceService = game:GetService("MarketplaceService")
Player = game.Players.LocalPLayer
 gui = Player.PlayerGui.ScreenGui
loading = gui.loading
results = gui.results

MarketplaceService.PromptPurchaseFinished:connect(function(Player, ID, isPurchased)
    if not isPurchased then return end -- Stop going any further because they didn't purchase the item. 
    if ID == AssetID then
        if Player.Character ~= nil then
        loading.Visible = false
        results.Visible = true

        end
    end
end)

Thank you for the help, it is greatly appreciated. You are helping in the development of the next great game on Roblox!

Answer this question