My script uses the arrow keys and the WASD keys, I can't figure out what it would be for mobile devices in place of for example the up arrow or the W key, I have read http://wiki.roblox.com/index.php?title=Mobile_controls but it doesn't seem to help me. Does anybody have a solution on how to fix this? I have imported some of my script which shows the computer controls
local movement = Vector3.new(0, 0, 0)
userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
movement = Vector3.new(movement.X, movement.Y, -1)
elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
movement = Vector3.new(movement.X, movement.Y, 1)
elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
movement = Vector3.new(-1, movement.Y, movement.Z)
elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
movement = Vector3.new(1, movement.Y, movement.Z)
elseif inputObject.KeyCode == Enum.KeyCode.Space then
local ray = Ray.new(horse.HumanoidRootPart.Position + Vector3.new(0, -4.3, 0), Vector3.new(0, -1, 0))
local hit, position = game.Workspace:FindPartOnRay(ray, horse)
if hit and hit.CanCollide then
horse.Mount:ChangeState(Enum.HumanoidStateType.Jumping)
end
elseif inputObject.KeyCode == Enum.KeyCode.H then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
end)
userInputService.InputEnded:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
if movement.Z < 0 then
movement = Vector3.new(movement.X, movement.Y, 0)
end
elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
if movement.Z > 0 then
movement = Vector3.new(movement.X, movement.Y, 0)
end
elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
if movement.X < 0 then
movement = Vector3.new(0, movement.Y, movement.Z)
end
elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
if movement.X > 0 then
movement = Vector3.new(0, movement.Y, movement.Z)
end
end
end
end)
