So I have this GUI where I use the MouseEnter and Leave events to change the image color of the imagebutton. The problem is that I cant reset the image to its original colors. How can I achieve this?
You will have to store variables to the original and new color:
local ColorOnHover = Color3.new()
local ColorOnExit = Color3.new()
I dont really understand what you mean. I tried this but I got an error:
local OgColor = script.Parent.ImageColor3
script.Parent.MouseEnter:Connect(function()
script.Parent.ImageColor3 = Color3.fromRGB(80,80,80)
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.ImageColor3 = Color3.fromRGB(OgColor[1], OgColor[2], OgColor[3])
end)
I tried saving it at the start but it gave error. IM def doing smthn wrong lol
Before you change the color, have it stored in a variable like this:
local PreviousColor
script.Parent.MouseEnter:Connect(function()
PreviousColor = script.Parent.ImageColor3
script.Parent.ImageColor3 = Color3.fromRGB(80,80,80)
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.ImageColor3 = PreviousColor
end)
1 Like
Thanks. Really appreciate the help!
1 Like