I have a GUI with six buttons. Each button represents an item that can be selected and made. I'm tried creating a number value and assigning a value whenever a button is clicked, so the game can track what was clicked by the player. I used this code inside the GUI, but it's giving me an error. What is the error and is it still possible to use a number value and assign an integer to it ?
selected = nil guiMain = script.Parent for _,gui in pairs(guiMain:GetChildren()) do if gui:IsA("ImageButton") then gui.MouseButton1Click:connect(function()) selected = gui end end end
You're calling an empty function with no end on line 6. The code should run if you move a closing bracket from line 6 to line 8.