I am making a script for a tycoon for when you step on a button. The problem is, I don't know how to put "button" as a parameter so i can reference it in the local function. Heres the code:
local function buy(part)
--code
end
for _, button in pairs(CollectionService:GetTagged("BuyButtons")) do
button.Touched:Connect(buy)
end
Any help?

3 comments
button.Touched:Connect(function() buy(button) end)
You can't send extra parameters with connect, only the parameters given by the function which is why we have to do this
are you also able to make "button" as a global variable?