How to detect if player using joystick/gamepad in mobile?

I want to detect if player is using joystick in mobile. The joystick which is players can move their characters with this in mobile. Is there a event for this?

Also i tried to use UserInputService.GamepadEnabled, but not worked.

did you check on the server side or on the client side?

i want to check it in client side

PUT IN CLIENT SCRIPT (LOCAL SCRIPT)

local DeviceType = game:GetService("UserInputService"):GetDeviceType()
print(DeviceType.Name)

EDIT: DOES NOT WORK The current identity (4) cannot GetDeviceType (lacking permission 5)

so you have checked it in the client side?

i checked it in client side with UserInputService.GamepadEnabled

Did you test it with real conditions?
Like a real gamepad…

umm i dont want to check player’s device, i just want to detect if player using joystick

do you mean mobile? ???

No, you missunderstanding :sweat_smile:, im saying joystick in mobile which is we can move our character with it

if game:GetService("UserInputService").TouchEnabled then
	print("You are in mobile")
end

You mean this?

If you want disable the joystick thing for all device:

game.StarterPlayer.DevTouchMovementMode = Enum.DevTouchMovementMode.Scriptable
local UserInputService = game:GetService("UserInputService")

local lastInput = UserInputService:GetLastInputType()

if lastInput == Enum.UserInputType.Touch then
	print("Most recent input was via touch")
end

No, i dont meant this. I meant I just want to detect if player using joystick and moving his character with it, like if w pressed then do anything and i want to make if player uses joystick then do anything.

um but it gets move direction of joystick :confused:
but i want to check if player uses joystick then do anything. just checking if player controls the player with joystick - moving character with it then do anything

Code?

local UserInputService = game:GetService("UserInputService")

local function OnInputChanged(Input, GameProcessedEvent)
		if Input.KeyCode == Enum.KeyCode.Thumbstick1 then
			print("Thumbstick 1")
			end
		elseif Input.KeyCode == Enum.KeyCode.Thumbstick2 then
			print("Thumbstick 2")
		end
end

UserInputService.InputChanged:Connect(OnInputChanged)

I have a solution just wait, ok

i tried it and its not working, but thanks for your help