Type Index Pages
- BillboardGui
- CanvasGroup
- Frame
- Hint
- ImageButton
- ImageLabel
- PlayerGui
- ScreenGui
- ScrollingFrame
- StarterGui
- SurfaceGui
- TextBox
- TextButton
- TextLabel
- UIAspectRatioConstraint
- UIGradient
- UIGridLayout
- UIListLayout
- UIPadding
- UIPageLayout
- UIScale
- UISizeConstraint
- UITableLayout
- UITextSizeConstraint
- VideoFrame
- ViewportFrame
- ChangeHistoryService
- CoreGui
- DataModelSession
- DockWidgetPluginGui
- MultipleDocumentInterfaceInstance
- Plugin
- PluginAction
- PluginGui
- PluginGuiService
- PluginManager
- PluginMenu
- PluginMouse
- PluginToolbar
- PluginToolbarButton
- QWidgetPluginGui
- Selection
- StandalonePluginScripts
- StatsItem
- StudioService
- StudioTheme
No results found!
-
Instance
- GameSettings
- DebugSettings
- BodyMover
- WeldConstraint
- HttpRbxApiService
- NotificationService
- Translator
- Lighting
- Beam
- GuiService
- UserInputService
- Studio
- Plugin
- HttpService
- Mouse
- BindableEvent
- RunService
- Pages
- Humanoid
- TestService
- PathfindingService
- Chat
- NetworkPeer
- Feature
- CharacterAppearance
- Constraint
- NetworkReplicator
- JointInstance
- Light
- BasePlayerGui
- AnalyticsService
- NetworkMarker
- BinaryStringValue
- FlyweightService
- Geometry
- LoginService
- InstancePacketCache
- ThirdPartyUserService
- TouchInputService
- RuntimeScriptService
- GuidRegistryService
- PartOperationAsset
- DialogChoice
- PhysicsService
- AdService
- TextService
- MarketplaceService
- TeleportService
- Accoutrement
- GamePassService
- AssetService
- InsertService
- PointsService
- ChangeHistoryService
- ServerScriptService
- JointsService
- LogService
- InputObject
- Toolbar
- LuaSettings
- RenderSettings
- AnimationTrack
- PhysicsSettings
- NetworkSettings
- CFrameValue
- Animation
- Color3Value
- BoolValue
- BrickColorValue
- Vector3Value
- AnimationController
- BindableFunction
- Button
- Trail
- LocalizationTable
- LocalizationService
- DebuggerBreakpoint
- DebuggerWatch
- ScriptDebugger
- Animator
- Attachment
- RemoteFunction
- RemoteEvent
- PluginManager
- Camera
- Stats
- Sky
- StarterPlayer
- Dragger
- TerrainRegion
- Path
- TextFilterResult
- Dialog
- StatsItem
- GoogleAnalyticsConfiguration
- ScriptContext
- ControllerService
- CacheableContentProvider
- ReflectionMetadataClasses
- ReflectionMetadataEnums
- DebuggerManager
- GuiBase
- UIBase
- LuaSourceContainer
- GuiItem
- DataModelMesh
- ServiceProvider
- ReflectionMetadataItem
- PostEffect
- PhysicsPacketCache
- TouchTransmitter
- RobloxReplicatedStorage
- Visit
- LuaWebService
- ScriptService
- FlagStandService
- VirtualUser
- SpawnerService
- TimerService
- CookiesService
- Team
- GroupService
- StarterGear
- Message
- PlayerScripts
- Configuration
- ContentProvider
- CollectionService
- Debris
- ReplicatedFirst
- ServerStorage
- ReplicatedStorage
- Folder
- TweenService
- Players
- ContextActionService
- StarterPlayerScripts
- SoundService
- KeyframeSequenceProvider
- VRService
- PluginGuiService
- Player
- Teams
- Pose
- Keyframe
- KeyframeSequence
- IntConstrainedValue
- DoubleConstrainedValue
- ForceField
- RayValue
- Fire
- Smoke
- Sparkles
- ParticleEmitter
- IntValue
- StringValue
- NumberValue
- Explosion
- ObjectValue
- SoundGroup
- UserGameSettings
- ClickDetector
- Sound
- Selection
- BadgeService
- TaskScheduler
- GlobalDataStore
- DataStoreService
- CustomEvent
- CustomEventReceiver
- VirtualInputManager
- FunctionalTest
- TweenBase
- SoundEffect
- ReflectionMetadataEvents
- ClusterPacketCache
- PVInstance
- FaceInstance
- Controller
- ReflectionMetadataCallbacks
- ReflectionMetadataFunctions
- ReflectionMetadataYieldFunctions
- ReflectionMetadataProperties
- ReflectionMetadata
- AdvancedDragger
- HapticService
- FriendService
- GamepadService
No Result Found !!!
GamepadEnabled
This property can only be read from. Attempting to write to it will cause an error.
This item is not replicated across Roblox’s server/client boundary.
This property describes whether the device being used by a user has an available gamepad.
local userInputService = game:GetService("UserInputService") if userInputService.GamepadEnabled then print("Gamepad enabled") else print("Gamepad not enabled") end
If gamepads are available, you can use UserInputService/GetConnectedGamepads
to retrieve a list of connected gamepads and UserInputService/GetNavigationGamepads
to retrieve a list of connected gamepads that also controlnavigation GUIs.
As UserInputService
is client-side only, this property can only be used in a LocalScript
.
See this page for articles on cross-platform development.
See also
UserInputService/GamepadConnected
UserInputService/GamepadDisconnected
UserInputService/GetConnectedGamepads
UserInputService/GetNavigationGamepads
UserInputService/SetNavigationGamepad
UserInputService/IsNavigationGamepad
UserInputService/IsGamepadButtonDown
UserInputService/GetSupportedGamepadKeyCodes
UserInputService/GetGamepadState
UserInputService/GetGamepadConnected
UserInputService/GamepadSupports
Code Samples
How to Use the Right Gamepad for Input
The following code sample is used in the default gamepad script, so if you are using the default controls you do not need to worry about this. If you are creating a custom script for handling gamepad controls, this is a good template for retrieving which Enum/UserInputType|gamepad enum
you should use as the primary gamepad controller.
This code looks for the lowest numbered UserInputService/GetNavigationGamepad|navigation gamepad
, and if no navigation gamepad is found, finds the lowest numbered UserInputService/GetConnectedGamepad|connected gamepad
. If there is no connected gamepad, we default to gamepad1. This ensures at least some gamepad will be able to do controls.
local UserInputService = game:GetService("UserInputService") local activeGamepad = nil function GetActiveGamepad() local activateGamepad = nil local navigationGamepads = {} navigationGamepads = UserInputService:GetNavigationGamepads() if #navigationGamepads > 1 then for i = 1, #navigationGamepads do if activateGamepad == nil then activateGamepad = navigationGamepads[i] elseif navigationGamepads[i].Value < activateGamepad.Value then activateGamepad = navigationGamepads[i] end end else local connectedGamepads = {} connectedGamepads = UserInputService:GetConnectedGamepads() if #connectedGamepads > 0 then for i = 1, #connectedGamepads do if activateGamepad == nil then activateGamepad = connectedGamepads[i] elseif connectedGamepads[i].Value < activateGamepad.Value then activateGamepad = connectedGamepads[i] end end end if activateGamepad == nil then -- nothing is connected, at least set up for gamepad1 activateGamepad = Enum.UserInputType.Gamepad1 end end return activateGamepad end if UserInputService.GamepadEnabled then activeGamepad = GetActiveGamepad() end
How this site use cookies
This Platform uses cookies to offer you a better experience, to personalize content, to provide social media features and to analyse the traffic on our site. For further information, including information on how to prevent or manage the use of cookies on this Platform, please refer to our Privacy and Cookie Policy.