I’m trying to make a GUI for my game but ran into an issue where the script does not run the code but broadcast an error instead.
local parent = script.Parent
local function onButtonActivated(pressed)
-- script goes here
end
parent.Build.MouseButton1Click:Connect(onButtonActivated(1))
I know that the error occurs at the final line because it has a parameter, but do not know how to deal with this issue. Is there any way around this?
The issue with that is the fact that I plan to add more buttons that will lead to that same function, and I need a way to detect which button was pressed in the function