I don’t know if I said the title right lol, basically I am working on this GUI where you can select multiple things, and unselect them, and if you select it adds the object to a table, and if you unselect it needs to remove it from the table. Here is my script:
selectedCrystals = {}
for _, v in next, script.Parent.MainFrame.Buttons:GetChildren() do
if v:IsA("TextButton") then
v.MouseButton1Click:connect(function()
if script.Parent.MainFrame.SelectShow[v.Name].Visible == true then
script.Parent.MainFrame.SelectShow[v.Name].Visible = false
table.remove(selectedCrystals, Dont Know how to get the Position)
else
script.Parent.MainFrame.SelectShow[v.Name].Visible = true
table.insert(selectedCrystals, #selectedCrystals + 1, v.Name)
end
end)
end
end