Hover button effects help

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()

if open.Value == false then

open.Value = true

buttonFrame:TweenSize(UDim2.new(0.23, 0,0.109, 0), Enum.EasingDirection.In,Enum.EasingStyle.Linear, 0.1 ,true)
text.TextColor3 = Color3.fromRGB(0, 0, 0)
background.ImageColor3 = Color3.fromRGB(255, 236, 21)

else
open.Value = false

buttonFrame:TweenSize(UDim2.new(0.21, 0,0.089, 0), Enum.EasingDirection.In,Enum.EasingStyle.Linear, 0.1 ,true)
text.TextColor3 = Color3.fromRGB(227, 210, 18)
background.ImageColor3 = Color3.fromRGB(144, 84, 0)

end
end)

1 Like

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


1 Like

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

so i put this in every of my button script?

i think this is too advance for me to understand sry

No just one local script will do. Just make sure your looping through where the actual buttons are.

Can you provide the code you are currently using so I can implement this for you?

ok i edited it check the top. .

Can you show us how you formatted your GUI? Like what is in the GUI, the contents and stuff.

so where should i put the script in?

but
every button is just like this

Can you show more of the hierarchy? Like what’s above Pets.

voin

fast

but

item

all of these are same nothing changes

By above I mean like can you show me all of it from ScreenGui itself?

the gui? i show it on at the top

Well yes but I don’t meed to know what it looks like. I want to see where everything is in the ScreenGui. Like all of the frames. Can you show that?

but why do you need it ?..

I need it so I can understand the layout of your GUI, so I can make the script work for you.

ok