Class
GamepadService
NotCreatableServiceNotReplicated
The GamepadService is internally responsible for handling inputs from various controllers, such as Xbox One or PlayStation DualShock controllers.
The GamepadService is internally responsible for handling inputs from various
controllers, such as Xbox One or PlayStation DualShock controllers. It also
handles APIs used with the gamepad virtual cursor. You can enable the gamepad
cursor for your experience by setting VirtualCursorMode under
StarterGui to Enabled.
Properties 1#
GamepadCursorEnabledboolean | The state of the gamepad virtual cursor.Write: RobloxScriptSecurityReadSafe |
GamepadCursorEnabled: boolean#
Write: RobloxScriptSecurityReadSafe
This boolean is a read only variable that maintains the state of the gamepad virtual cursor. You can read this property but not write to it.
Methods 2#
| DisableGamepadCursor | Disables the gamepad cursor, if currently enabled. |
| EnableGamepadCursor | Enables the gamepad cursor or updates its position. |
DisableGamepadCursor(): ()#
This function disables the gamepad cursor, if it's currently enabled.
Returns
()
EnableGamepadCursor(guiObject: Instance): ()#
This function enables the gamepad cursor if it's currently disabled. If
the cursor is already enabled, calling the API updates the cursor's
position. The function accepts a GuiObject parameter,
but there are some invalid cases. Please note that in order to set the
cursor to the default position, nil must be passed in as a parameter.
Providing no argument will result in an error.
| Input GuiObject | Cursor Starting Position | |
|---|---|---|
Nil |
Default position | |
| Not a GuiObject | Cursor does not appear, errors | |
| Not a child of BasePlayerGui | Cursor does not appear, errors | |
| GuiObject has Visible 2 set to false or any parent visible set to false | Default position with warning | |
| Child of ScreenGui 1 with Enabled 1 set to false | Default position with warning | |
| Child of BillboardGui 4 or SurfaceGui | Default position with warning | |
| GuiObject outside the viewport (Or, any part of the gui object that is off screen) | Default position with warning | |
| Child of ScrollingFrame with clipping set to false: GuiObject outside of scrolling frame (Object child of scrolling frame and not visible on screen) | Default position with warning | |
| Child of ScrollingFrame with clipping set to true: GuiObject outside scrolling frame window but inside viewport | GuiObject moves into the scrolling frame and starts the cursor centered over the object | |
| GuiObject inside the frame and visible | Cursor starts centered on the GuiObject |
| Name | Type | Default | Description |
|---|---|---|---|
guiObject | Instance | A GuiObject to center the virtual cursor on when enabled, or
nil to use the default cursor position. |
Returns
()
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild