Hiya.
I’m working on a game at the moment, and there’s horses for the Guards to ride, however, I don’t know how to make them mobile compatible.
Here’s what I have:
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.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
elseif inputObject.KeyCode == Enum.KeyCode.LeftShift then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
end)
I am trying to make it so that the mobile movement features can work with this horse. Anyone got some tips?