Hello Everyone,
Im making a main menu with the buttons having a background appear when the player hovers over one of the buttons. Though, theres a problem with the background not appearing quick and smooth, and the background not going all the way back down to 1 transparency. Theres also another problem when the player moves their cursor on all of them, they bug out a bit. Can anyone explain how I could fix this. Here is the code and the video to the problem.
local textButton = script.Parent
local imageLabel = textButton.Parent:WaitForChild("ImageLabel")
-- Function to fade in the ImageLabel
local function fadeIn()
for i = 0, 0.37, 0.05 do
imageLabel.ImageTransparency = 1 - i
wait(0.05)
end
end
-- Function to fade out the ImageLabel
local function fadeOut()
for i = 0.37, 0, -0.05 do
imageLabel.ImageTransparency = 1 - i
wait(0.05)
end
end
-- Connect the hover events
textButton.MouseEnter:Connect(fadeIn)
textButton.MouseLeave:Connect(fadeOut)