[DEPRECATED] Custom XBOX Cursor

I made this in one sitting last night to help make my game more xbox-friendly. You simply just drop it into the StarterGui and then when the player presses select it disables their controls (you must be using the new PlayerScripts layout) & puts a cursor in the middle of the screen which can then be moved around with the left trigger. When it’s hovering over a TextButton, ImageButton, or TextBox it sets GuiService.SelectedObject to that UI. You can then press A and it will click it. This is compatible with MouseButton1Click and Activated and nothing should have to be changed within your UIs.

I have noticed that this can get a little bit laggy with a ton of selectable buttons, however I tried to fix that today by not running collision calculations for UIs that aren’t visible. If you find any more problems or have an easier, less-laggy way to do this please let me know.

Here’s the model: Custom XBOX Cursor - Roblox

UPDATE 07/05/2019
I’ve made some changes to the way that the UI selector works, thanks to some suggestions from @goreacraft! If you’re currently using this in your game I would suggest you update to the newest version as it will be much less laggier if you have tons of UIs in your game!

UPDATE 01/08/2023
I noticed that this is still getting likes, so I figured I would update this post and let you know that this has officially been deprecated. It still works as far as I know, but it will no longer be updated or supported. If you’re looking for a cursor for XBOX, Roblox has now released an official one here: Gamepad Virtual Cursor - Studio Beta

74 Likes

Great model!

Although, I feel like this would be better suited in #learning-resources:community-tutorials-resources ! :wink:

6 Likes

Gosh heccin’ darn it!
I just got done coding this for myself!

6 Likes

Well it’s not really a tutorial though. It’s just a model you drop in your game.

2 Likes

The category he posted doesn’t link to tutorials, it links to Community Resources. Community Resources is a public subcategory of Learning Resources where both members and non-members can view your items and take them or experiment with what you post. Cool Creations is for showing off your works but only members can see the thread. If you’re looking to share a model, you should move it to the category he linked. If not, it’s fine here.

3 Likes

Oh okay, thank you. I have moved it :grin:

3 Likes

Useful for many things, great job! :+1:

2 Likes

Thank you! If you have any suggestions to make it better please let me know.

2 Likes

Just spent 3+ hours fixing tons of bugs with this system that players in my game have been reporting. This now supports ScrollingFrames, takes into account ClipsDescendants, and I applied TONS of performance fixes. If you use this let me know what you think!

6 Likes

why not use something like this?
https://developer.roblox.com/en-us/api-reference/function/BasePlayerGui/GetGuiObjectsAtPosition
i tried your solution and it fails to detect some buttons i add by scripts, i don’t know why.
i will try and make a version with your cursor movement part in combination with GetGuiObjectsAtPosition
Thank you for your share, as it helped a lot

P.s.: i can share my solution here if you want

3 Likes

Hi, I didn’t notice this was a thing! :o

I’ll update my system to use this tonight sometime. Thanks!

4 Likes

Do you think it is possible for the cursor to detect backack gui frames too? as the cursor just goes under any gui from default roblox inventory ( i think it is not possible as they are part of CoreGui)

Yeah unfortunately any kind of UI inside of the CoreGUI it can’t detect.

i think the proper way to disable and enable the mouse is require(player.PlayerScripts.PlayerModule):GetControls():Disable() not require(player.PlayerScripts.PlayerModule.ControlModule):Disable(), i am not entirely sure about this one, but i thought i might share this to you

Nice work! This will be extremely useful in making my game xbox compatible, I had pretty much given up until now.

I made a fork of this with some extra features I needed in my game (mostly on the fly enabling and disabling). Take a look if you’re interested:

1 Like

This is a great tool and I have been using it for a few months now. I just ran into a problem where I put it in a shared package and now when the player resets his character, they can’t move until I hit select and then hit select again. If I remove it from the package it works fine. The package adds another parent on top of the screen, but there doesn’t seem to be anything in the scripts that would care about that. Any ideas?

Hmm, It’s possible that instead of player.PlayerGui I set it to search the descendants of “script.Parent.Parent”. I can’t confirm, however, if that’s true because I haven’t really touched this code much since the last time I posted that I updated it. I can look at it tomorrow if I remember and let you know.

As a temporary workaround you can run this code in a Local Script when the player respawns:
require(player.PlayerScripts.PlayerModule.ControlModule):Enable()

This is really cool. I’m currently tweaking it a little bit, is it ok if I upload my tweaked version to Resources - DevForum | Roblox? Of course, I would credit you.

2 Likes

Does this model support dragging?
AKA: Hold down the mouse to drag a UI object or such.

Yes, that’s fine! I’d love to see what you’ve done.