Hey! So, I’m making a little “fancier” menu Interface. I’m using a SurfaceGui with ImageButtons and ImageLabels on it. Whenever I hover over these GUIObjects, they will move slightly to the right, and switch color.
This somewhat works, although, it is very unreliable on when it works.
Here’s a video example:https://www.youtube.com/watch?v=AJXU31KZjY8
I am using MouseEnter and MouseLeave event, which I have discovered are very unreliable. Although, why does it fire only a couple of times, decides to not care about the mouse for a couple of seconds, and then just work again?
Not only that, but I got a MouseButton1Click event hooked up with the button, although, it doesn’t work when the hover event doesn’t work. Does this mean that the SurfaceGui is not registering my mouse?
It’s the same problem when I start a server by pressing “Play” on the game page.
Here is the function that fires for every single button
local function moveTween(button)
local MoveIncrement = 0.01
local TweenDuration = 0.2
local OriginalPosition = button.Position
if button.Name == "NextChapter" or button.Name == "PreviousChapter" or button.Name == "EnterChapter" then
button.MouseEnter:Connect(function()
button.ImageColor3 = Color3.new(170, 0, 0)
end)
button.MouseLeave:Connect(function()
button.ImageColor3 = Color3.new(255, 255, 255)
end)
else
button.MouseEnter:Connect(function()
button.ImageColor3 = Color3.new(170, 0, 0)
local newPos = UDim2.new(OriginalPosition.X.Scale + MoveIncrement, 0, OriginalPosition.Y.Scale, 0)
button:TweenPosition(newPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, TweenDuration, true)
end)
button.MouseLeave:Connect(function()
button.ImageColor3 = Color3.new(255, 255, 255)
button:TweenPosition(OriginalPosition, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, TweenDuration, true)
end)
end
end
Thanks for dedicating time to help me!
If you’re in need of more information, please reply to this question!
- Sethex aka. TheWaterFoox