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.
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:
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.
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.
Oh, didnt see that it existed on buttons, thanks for the help.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.