Loading...
Loading...
UserInputService, ContextActionService, keyboard/mouse/gamepad/touch, cross-platform input binding.
npx skill4agent add tabooharmony/roblox-brain roblox-inputLocalScriptRunContextUserInputServiceInputBeganInputChangedInputEnded(input: InputObject, gameProcessedEvent: boolean)InputBeganKeyboardEnabledMouseEnabledTouchEnabledGamepadEnabledAccelerometerEnabledGyroscopeEnabledVREnabledPreferredInputUIS:IsKeyDown(Enum.KeyCode.W)
UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
UIS:IsGamepadButtonDown(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonA)
local dx, dy = UIS:GetMouseDelta()ContextActionServiceInputBeganlocal CAS = game:GetService("ContextActionService")
local function onAction(name, state, _input)
if name == "Jump" and state == Enum.UserInputState.Begin then
humanoid.Jump = true
end
end
CAS:BindAction("Jump", onAction, true,
Enum.KeyCode.Space, Enum.KeyCode.ButtonA)BindAction(name, handler, createTouchButton, ...inputTypes)ContextActionResult.Sink.PasscreateTouchButton=trueImageButtonPlayerGui.ContextActionGui.ContextButtonFrameCAS:GetButton(name)SetTitleSetImageSetPositionSetDescriptionGetConnectedGamepads()Gamepad1Gamepad8GamepadConnectedDisconnectedTouchTapTouchTapInWorldTouchPanTouchPinchTouchRotateTouchSwipeTouchLongPressTouchDragTouchStartedTouchMovedTouchEndedgameProcessedEvent=trueBindActionBindActionAtPriorityJumpRequestInputChangedreferences/full.mdContextActionResult