ImageLabels - MouseEnter causing conflict with TouchSwipe

I am in the process of making a new menu GUI for a game i’m working on. I wanted to try and add mobile support to the menu with a little more then just clicking. The option for using a mouse is working properly however when I simulate it and attempt to use the mobile for swiping I run into an issue. If I tap (click) then it opens, I am trying to get it to only open when you swipe.

Goal for this is to have the three scrolls that will be our menu buttons, Continue, New, and Information/Updates.

When the user mouses over/goes onto/fingers over the scrolls then the goal is to move them out and when they go off to move them back, that way the only one that’s out is going to be the one you’re trying to select.

Inside of each Scroll is an IntValue named State. This will be used to determine if the scroll is open or closed. This is mainly used for the Mobile Devices so they can swipe the scrolls open and closed. 0 = Closed, 1 = Open

Video of this being used with purely the mouse and working as intended.

Video of the simulated mobile device where the issue is occuring.

local GUI = script.Parent

local InputService = game:GetService("UserInputService")

local TweenService = game:GetService("TweenService")

function TweenGUI_Object(info, obj, goal)

local NewTween = TweenService:Create(obj, info, goal)

NewTween:Play()

end

function Enter_Menu_Scroll(OBJ, Height)

local theInfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false)

local theGoal = {Position = UDim2.new(0, 60, 0, Height)}

TweenGUI_Object(theInfo, OBJ, theGoal)

if OBJ:FindFirstChild("State") then OBJ.State.Value = 1 end

end

function Exit_Menu_Scroll(OBJ, Height)

local theInfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false)

local theGoal = {Position = UDim2.new(0, -125, 0, Height)}

TweenGUI_Object(theInfo, OBJ, theGoal)

if OBJ:FindFirstChild("State") then OBJ.State.Value = 0 end

end

-- Events ! --

GUI.MainFrame.Scroll_1.MouseEnter:connect(function() Enter_Menu_Scroll(GUI.MainFrame.Scroll_1, 20) end)

GUI.MainFrame.Scroll_1.MouseLeave:connect(function() Exit_Menu_Scroll(GUI.MainFrame.Scroll_1, 20) end)

GUI.MainFrame.Scroll_1.TouchSwipe:connect(function(SwipeDirection, NumberTouches)

print("SWIPE", SwipeDirection)

if SwipeDirection == Enum.SwipeDirection.Right then

Enter_Menu_Scroll(GUI.MainFrame.Scroll_1, 20)

elseif SwipeDirection == Enum.SwipeDirection.Left then

Exit_Menu_Scroll(GUI.MainFrame.Scroll_1, 20)

end

end)

GUI.MainFrame.Scroll_2.MouseEnter:connect(function() Enter_Menu_Scroll(GUI.MainFrame.Scroll_2, 100) end)

GUI.MainFrame.Scroll_2.MouseLeave:connect(function() Exit_Menu_Scroll(GUI.MainFrame.Scroll_2, 100) end)

GUI.MainFrame.Scroll_3.MouseEnter:connect(function() Enter_Menu_Scroll(GUI.MainFrame.Scroll_3, 180) end)

GUI.MainFrame.Scroll_3.MouseLeave:connect(function() Exit_Menu_Scroll(GUI.MainFrame.Scroll_3, 180) end)

--------------

I’ve tried adjust how I go about and just using the MouseButton1Down and such but that doesn’t quite give the effect I want. I am unsure if there’s a way to get a similar event to MouseEnter and MouseLeave for a specific UI element using the UserInputService.

MouseEnter has been known to be buggy and unreliable. Maybe you should try using this module that replaces MouseEnter and MouseLeave.