Need help with elevator script

I made an elevator part that moves players when they touch it.
The issue is that players always move upward instead of moving in the right direction.
I want the part always pushes players in its direction without preventing the player from moving horizontally.

elevator = script.Parent
config = elevator:FindFirstChildWhichIsA("Configuration")

function Touch(hit)
	local character = hit.Parent
	local humanoid = character:FindFirstChild("Humanoid")
	local root = character:FindFirstChild("HumanoidRootPart")
	
	if not humanoid or not root then return end
	if root:FindFirstChild("ElevatorVelocity") then return end

	local faceVector = elevator.CFrame.RightVector

	local velocity = Instance.new("LinearVelocity", root)
	velocity.Name = "ElevatorVelocity"
	velocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis
	velocity.MaxAxesForce = Vector3.new(0, math.huge, 0)
	velocity.VectorVelocity = faceVector * config:GetAttribute("Speed")
	velocity.Attachment0 = root:FindFirstChildWhichIsA("Attachment") or Instance.new("Attachment", root)
end

function TouchEnded(hit)
	local character = hit.Parent
	local humanoid = character:FindFirstChild("Humanoid")
	local root = character:FindFirstChild("HumanoidRootPart")

	if not humanoid or not root then return end
	local elevatorVelocity = root:FindFirstChild("ElevatorVelocity")
	if not elevatorVelocity then return end

	for _, part in ipairs(workspace:GetPartsInPart(elevator)) do
		if part.Parent == hit.Parent then return end
	end
	
	elevatorVelocity:Destroy()
end

return function()		
	elevator.Touched:Connect(Touch)
	
	elevator.TouchEnded:Connect(TouchEnded)
end

Your MaxAxesForce is only allowing Y-axis movement. That’s why it only goes up.

Change this:

velocity.MaxAxesForce = Vector3.new(0, math.huge, 0)

To this:

velocity.MaxAxesForce = Vector3.new(math.huge, math.huge, math.huge)

That lets the velocity work on all axes so it’ll actually move in the direction you’re setting.

The issue with this is that it makes players unable to move when they touch it.
By example, if the elevator moves vertically, players won’t be able to move horizontally.

What direction is the elevator supposed to move?

It’s supposed to work on all directions.

Apparently the issue is with this vector.
Is your elevator oriented correctly?