I want the player to move foward and down at the same time when a player holds down "wasd" keys. although the player moves down slowly, the player's character does not move toward the position the player is facing. It doesn't move at all. Is there something wrong I'm doing?

local orientation = plr.Character.Humanoid.MoveDirection.z

mouse.KeyDown:Connect(function(key)
	key = key:lower()
	if key == "w" or key == "a" or key == "s" or key == "d" then
		while true do
			wait (.01)
			plr.Character.LowerTorso.BodyVelocity.Velocity = Vector3.new(0, -81, 	orientation)
		end
	end
end)

1 comment

0

KeyDown is deprecated, use UserInputService.