UserInputService Help

Hello, Im trying to make a script on how to tell if Xbox controller buttons were press but I don’t know which Function it is.

1 Like

Here’s a tutorial on the developer hub on this topic: Gamepad Input | Documentation - Roblox Creator Hub :smile:

I try Article and it really didn’t help Problem

Do you want to detect a specific button, or any?

If you are trying to do something when a button is clicked I would use ContextActionService

1 Like

@ABHI1290 @0x6e7367
Im trying to check to see if input was change but in my script it goes to Xbox or Pc but dosn’t change Image/Xbox
local function CheckPC(self)
if self.UserInputType == Enum.UserInputType.Keyboard or Enum.UserInputType.MouseMovement then
script.Parent.Parent.ContiueA.ImageLabel.Image = Mouse
script.Parent.Parent.NewgameA.ImageLabel.Image = Mouse
script.Parent.Parent.OptionsA.ImageLabel.Image = Mouse
script.Parent.Parent.UpdateA.ImageLabel.Image = Mouse
end
end

local function CheckXbox(self)
if self.UserInputType == Enum.UserInputType.Gamepad1 or Enum.UserInputType.Gamepad2 then
script.Parent.Parent.ContiueA.ImageLabel.Image = A
script.Parent.Parent.NewgameA.ImageLabel.Image = A
script.Parent.Parent.OptionsA.ImageLabel.Image = A
script.Parent.Parent.UpdateA.ImageLabel.Image = A
end
end

UserInputService.InputBegan:Connect(CheckPC)
UserInputService.InputBegan:Connect(CheckXbox)