How do I make a UI slider?

Basically, I’ve been interested in making a UI slider, but here’s the thing: it needs to be mobile compatible.

Most of the documentation relates to MouseButton1Down and, as from my experience, whenever I would play on mobile, that would not work at all.

What is the best way to make a slider bar that is both Mobile & PC compatible?

Any feedback is appreciated! Thanks a lot!

3 Likes

What do you mean by UI slider? Are you talking about a Scrolling Frame?

You know those volume bar things that can be dragged while also modifying the volume as it does? Most of the people refer to that as a UI slider, though I don’t know if that name is still being used to describe it.

Ahhh, are you sure MouseButton1Down doesnt work on mobile? Try testing it on the actual Roblox app to see if it works. Also are you using a Frame or an ImageLabel?

2 Likes

That is what you’re looking for!

4 Likes

Prior to checking it out: Does the Mouse1Button also apply for mobile users as well?

I’m just speaking about my old experience, like 2 years ago. I’ve definitely gotten better in the meantime, but I just want to double-check prior to writing a full code that relies on it.

MouseButton1Down is always compatible with ALL devices. If you’re concerned still, check out UserImputService!

2 Likes

Yep, MouseButton1Down, MouseButton1Click, etc works on mobile users (although I used to experience a bug where these mouse events wont work on an ImageButton so I just replaced them with a ImageLabel and an invisible TextButton on top of the Image.)

1 Like

Alright! Thanks for the advice, everyone. I’ll definitely keep those things in mind.

2 Likes

https://developer.roblox.com/en-us/api-reference/event/GuiObject/TouchTap
https://developer.roblox.com/en-us/api-reference/event/GuiObject/TouchLongPress

Wow!
I used to make a table with PC, mobile and console inputs and then proceed to loop and connect all of them to events

1 Like