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 , 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
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
oki ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
I Found!
Make a Server Script with this code:
local inputbegan=Instance.new("RemoteEvent",game.ReplicatedStorage)
local inputchanged=Instance.new("RemoteEvent",game.ReplicatedStorage)
local inputended=Instance.new("RemoteEvent",game.ReplicatedStorage)
inputbegan.Name ="InputBeganJoystick"
inputchanged.Name ="InputChangedJoystick"
inputended.Name ="InputEndedJoystick"
inputbegan.OnServerEvent:Connect(function(plr)
print(plr.Name.." has moved the joystick")
end)
Then you paste the PlayerModule In Starter Player > Starter Player Scripts
PlayerModule.rbxm (124.7 KB)
thank you so much finally it worked
um but it also detects when i click screen
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.