I'm trying to detect the movement keys (W,A,S,D) on touch screen but can't figure out how.
What I have so far:
UIS.TouchStarted:Connect(function(touch, gameProcess) if touch.UserInputType == Enum.UserInputType.Touch then end end)
This code has not been tested so I am not sure if it will work. The UserInputService is used to detect if the user input type is a mobile device, if it is it will proceed to the rest of the script, if it is not, it will not proceed but you can change it to what you want it to do:
local uis = game:GetService("UserInputService") if uis.KeyboardEnabled == false and uis.TouchEnabled == true then print("Touch screen is enabled") function OnTouch(input,gameProcessedEvent) if input.UserInputType == Enum.UserInputType.Touch then --- Code Here end end uis.InputBegan:Connect(OnTouch) else print("Touch screen is not enabled") end