Hi, I wanted to know if there was a method to automatically enable UI Navigation for those who play with a controller on a game and how I can do it. I tried searching online but couldn’t find anything. I appreciate any help.
If I understood correctly I think you mean something like this?
local UserInputService = game:GetService("UserInputService")
local isGamePad = UserInputService.GamepadEnabled
if isGamePad then
print("player has a gamepad!")
else
print("player is not on gamepad")
end
Yes but instead of printing that a player has a gamepad it automatically enables UI Navigation.
Uhm so you want them to be instantly in UI Navigation?
Lets say no, I think it should look something like this:
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
local isGamePad = UserInputService.GamepadEnabled
if isGamePad then
GuiService.GuiNavigationEnabled = true
else
GuiService.GuiNavigationEnabled = false -- change this if you want to
end
It doesn’t seem to work. Thank you very much for the help anyway.
By default Roblox will enable the gamepad user with Roblox’s default navigation. However, you must ensure that Gui Objects such as those of the TextButton class have their Selectable property set to true to be picked up by Roblox’s default navigation. Ideally, you would test your experience first hand using a gamepad to make sure that the default navigation works well for your experience, otherwise you would need to program a tailor made solution for your experience.