Greetings, I’m currently trying to pass more than one argument in a :Connect() function, but once I retrieve the second argument and print it, it says nil. Any help? Am I doing this correctly.
for i,v in pairs(productsFolder:GetChildren()) do
if not productsExample.Parent:FindFirstChild(v.Name) then
local newGui = productsExample:Clone() -- Creates available products for purchase GUI
newGui.Parent = productsExample.Parent
newGui.Visible = true
newGui.Name = v.Name
newGui.ProductName.Text = v.name
newGui.Price.Text = "$" .. prices.Stores[storeName][v.Name].Price
newGui.Minus.MouseButton1Click:Connect(AddPurchase, newGui.Name)
newGui.Plus.MouseButton1Click:Connect(RemovePurchase, newGui.Name)
end
or you can use a Higher ordered function like this
local function AddPurchase(Param)
return function()
--put the code you have for the function here
end
end
--then just do this
newGui.Minus.MouseButton1Click:Connect(AddPurchase(newGui.Name))