How can I automatically enable UI Navigation for those who play with a controller?

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.

2 Likes

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


1 Like

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


6 Likes

It doesn’t seem to work. Thank you very much for the help anyway.

1 Like

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.

3 Likes