[Lua + Ts] Controller Cursor (OpenSource)

ModuleScript > LocalScript, especially when it comes to creating a service, and amplified when inserting other people’s code into your game.

This module can be required from any of your scripts, allowing you to have them all interact with it and its state. It has events and APIs like a Service, and a LocalScript could offer none of that.

If we look at my example above, it’s only possible with a module.

I have to call :HideCursor() and :ShowCursor() when the user wants to drag a slider setting.
I have to connect to the .CursorActivated and .CursorDeactivated events to know when to halt the custom movement.
I have to connect to the .GuiObjectSelectionStarted event to display the button icon next to the hovered gui.

All of those are crucial, and they work right out of the box with this module.

4 Likes

Wow! That’s so cool!

This isn’t really related, but could someone pls explain to me what a “testimonial” is?

1 Like

It’s when someone gives thanks / endorses someone or something.

3 Likes

This looks amazing and very useful, great job.

3 Likes

Nice job!
That is really helpful, and I’ll make sure to implement it.

2 Likes

Could you explain me that and how it works? :slight_smile:

2 Likes

This module’s APIs are clearly documented in OP.

local GamepadCursor = require(script.GamepadCursor)

GamepadCursor:HideCursor()
wait(3)
GamepadCursor:ShowCursor()

You just call those functions when your state requires it, like when a player begins dragging a slider.

3 Likes

100% Scrolling Frame support aswell? :thinking:

2 Likes

Natively! This module simply sets the GuiService’s selected object automatically, meaning default game pad keybinds automatically work.

4 Likes

Interesting. I’m trying it here, doesn’t seem to be scrolling all the way down to the bottom (using a Scrolling Frame with a UIListLayout along with multiple buttons):
https://gyazo.com/66060c8c6c2aaaa6c2a380d0b028b2a8

(fantastic contribution btw)

1 Like

Hmm. I’ll look into that. I remember running into that issue and fixing it a while ago. Probably got lost in the open sourcing.

2 Likes

I don’t require outside modules… lol. Pretty sure that’s not even possible anymore.

How can it not be trusted if all of the code required is there…

Please do your research before making such claims.

As for your module, I’ve got to admit that it does allow a lot more control than mine does, but it doesn’t appeal to the basic developer. My system is more of a one-size-fits-most approach.

2 Likes

I just tested in studio and scrolling frames seem to be working perfect. You have to use the right thumbstick as that’s roblox’s default keybind. If this doesn’t work, I don’t know what the issue is :frowning:

2 Likes

Ah right, It seems that you need to find and hover over an empty-space in the Scrolling Frame for it to scroll properly.

2 Likes

Hmmm. Let me check. I didn’t observe that behavior when I tested but I’ll fix it

2 Likes

Sorry for being almost exactly four months late, but I just wanted to share a fork I made of this module that fixes the aforementioned ScrollingFrame bug! I also found that the speed of the cursor was tied to FPS, so I fixed that up too. Check it out if you’d like: GamepadCursor (+) - Roblox

I also put the source onto Pastebin, 'cause why not?

It’d be cool if these fixes could be put into the real module! That way, we can have a better cursor experience for everyone. :slight_smile:

p.s. i am extremely sorry for reviving a 4 month old thread

3 Likes

If you want to open a Pull Request on the GitHub repo, I’d be happy to merge it in.

1 Like

I’m gonna be honest here, I… have no idea how to make a pull request… I’ve never done it before… :sweat_smile:

update: i have no idea what i’m doing but im still trying don’t worry

1 Like

Alright, I think I managed to do it correctly. Let me know if I didn’t, as I wouldn’t be very surprised. Thank you!

How do I use it? I have a ps4 controller and it doesnt work.