What is the best way to detect when a swipe happened from the very right of the screen on mobie?

Hello,

I’m trying to make a system where if a player on mobile swipes to the left from the very right of the display, it’ll trigger a function.

I’ve tried what I know, but I haven’t been able to figure it out yet.

You need to use the UserInputService and track the TouchStarted and TouchEnded events:

1 Like

Adding on from @BadDad2004 's post, you can also have a UI Frame in the right hand corner of the screen and use the TouchSwipe event.

The TouchSwipe event fires when the player performs a swipe gesture on the UI element using a touch-enabled device. It fires with the direction of the gesture (Up, Down, Left or Right) and the number of touch points involved in the gesture.

2 Likes

I already had this code:

UserInputService.TouchSwipe:Connect(function(SwipeDirection, Number, Processed)
	if SwipeDirection == Enum.SwipeDirection.Left then
		
	end
end)

I just wasn’t sure to detect if it came from the very end of the screen.

Ah ok. Like I said in my first post you can have a UI Frame located in the right hand corner of the screen which will only fire the TouchSwipe event on that UI Frame in the right hand corner. If you had a UI Frame covering the entire screen, the TouchSwipe event will fire anywhere on the screen.

Hope this helps.

1 Like

Oh, didnt see that it existed on buttons, thanks for the help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.