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

2 comments
You are missing a ')' on line 8, i.e "end)". Also you have on too many ')' on line 6.
BlackJPI answered your first question correctly. For your second question: Yes, it is possible to assign an Integer to a NumberValue.