does anyone know how to make it like if i click another button the other will back to normal
here is my button script
local open = script.Parent.Parent.Parent.Open
local buttonFrame = script.Parent.Parent.Parent
local text = script.Parent.Parent.TextLabel
local background = script.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
The way I did it for my other game is to do a simple for index and value statement, checking GUIs in the table and then returning them back to normal if the GUI is clicked. Here’s an example:
--//Services
--?
--//Variables
local GUIsInUse = {}
--//Main
--Whatever method you're using to check the clicks and make the button look clicky,
table.insert(GUICLICKED)
for i,v in pairs(GUIsInUse) do
table.remove(GUIsInUse,i)
--return that button back to normal
end
I would set a variable for the Button that’s been clicked. Then loop through all the buttons and when they have been clicked, I would check if clickedButton is nil. If it’s not nil, then go back to normal.
local clickedButton = nil
for _, button in pairs(Frame:GetChildren())
button.MouseButton1Click:Connect(function()
if clickedButton ~= nil then
— Change clicked button to normal.
clickedButton = button
end
— Change the new clicked button to be bigger.
end)
end