I'm trying to call a custom function through a button click connection and I want to pass an argument to the function but I'm getting an error that says the passed value (AddQuant('Food')) is not a function. What do I need to do to pass that argument? I don't want to use an anonymous function, and I've already checked spelling and capitalization. Anyways, here's the connection line and function.
--The function
function AddQuant(type)
amount[type] = amount[type] + incriment[type]
Labels[type].Text = "Food: " .. amount[type]
end
]
--The connection line
Buttons['Food'].MouseButton1Click:connect(AddQuant('Food'))
Thanks for any help.
-GoldenPhysics
Edit: added function being called.

1 comment
I was hoping for a shorter connection line, but It works well. Thanks!