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

How come this GUI Button isn't working?

Asked by 8 years ago

Hey, Scripting Helpers!

I tried making a GUI where players can order drinks. Everything seems to work except for the part where the purchase dialog pops up. Here's my script. Any help will be appreciated!

local ReplicatedStorage  = game:GetService('ReplicatedStorage')
local MarketplaceService = game:GetService('MarketplaceService')

local NevermoreEngine = require(ReplicatedStorage:WaitForChild('NevermoreEngine'))
local LoadLibrary     = NevermoreEngine.LoadLibrary

local ClientVariables = LoadLibrary('ClientVariables')
local ScrollingFrame  = LoadLibrary('ScrollingFrame')
local qSystems        = LoadLibrary('qSystems')

local Interface   = ClientVariables.Interface
local LocalPlayer = ClientVariables.LocalPlayer
local Class       = qSystems.Class

local DrinkButton   = Interface:WaitForChild('DrinkButton')
local DrinkChooseFrame = Interface:WaitForChild('DrinkChooseFrame')
local ShopFrame   = DrinkChooseFrame:WaitForChild('ShopFrame'):WaitForChild('Container')


local DrinkMenu = {}

local Drinks = {
    {'StarbloxLatte', 19342431},
    {'Bloxycola', 19342461},
    {'Cheezburger', 19342487},
    {'ChocolateMilk', 19342493},
    {'BubbleGum', 19342499},
    {'IceCream', 19342508},
    {'Pizza', 19342529},
    {'DizzyDrink', 19342534},
    {'SkeleDrink', 19342548},
    {'Taco', 19342548},
    {'Watermelon', 19342548}
}

local DrinkClass = Class(function(Drinks, Name, AssetId)
    for _,v in pairs (ShopFrame:GetChildren()) do
        if v.Name ~= "Drinks" and v.Name ~= "Foods" then
            v.OrderButton.MouseButton1Click:connect(function()
            MarketplaceService:PromptProductPurchase(LocalPlayer, AssetId)
            print(Name)
        end)
        end
    end
end)

return DrinkMenu

-Z

0
AssetId in line 40 is not a argument. rexbit 707 — 8y
0
Yeah it is, the second of four arguments for PromptProductPurchase is productID BlackJPI 2658 — 8y
0
I'm not sure how the Class funciton of qSystems library works, so I'm not sure how DrinkClass accually connects to a button press. BlackJPI 2658 — 8y

Answer this question