So, I have this roblox game, and you fight others in it. I recently added xbox support, but now they’re asking for shiftlock since it’s pretty hard to fight without it. I used up all the buttons on the xbox controller for doing moves, so I thought of using a gui that they can click on that would toggle shiftlock. How would I make this?
Perhaps this would help?
I would say, for right now anyway, don’t.
As we see with a something called Mobile Mouse lock, it can frequently break as ROBLOX is in the process of bolstering the security of it’s Camera modules. However, I would look into the aforementioned Mobile Mouse lock as a good starting point of how something like it could be accomplished (mostly emulating standard Mouse lock effects such as offsetting the camera and actually locking the mouse through camera manipulation).
At the end of the day though, perhaps adding a different method of execution for these fighting mechanics to make them a bit less intensive on the XBOX players would be the better alternative in the long run. If there is a viable option, even if a bit more demanding in terms of development, manipulating the Camera Modules in a way that is most likely going to be patched by ROBLOX in the future anyway should be avoided.
Can a camera be locked for Xbox/Controllers the same way you would for PC?
If I am not mistaken there is a property in the local player that is called “ShiftLock” where you can set it there as a boolean but I think I got the name wrong.
There is a boolean of player called DevEnableMouseLock
which is what you may be thinking of but this only controls whether a PC player can or can’t enable mouse lock, there is no simple way to enable mouse lock like with a boolean value - it’s a very convoluted system that involves a fair bit of camera manipulation in order to get right.
As @S_maritan stated, I’d recommend looking into Mobile Mouse Lock, that might be your best option when it comes to emulating mouse lock for Console platforms.
You need to edit the MouseLockController module script located in PlayerModules under StarterPlayerScripts. Where it says “Enum.KeyCode.LeftShift/RightShift” add another one for an Xbox
controller button. Hope this helps.