Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Body velocity humanoid.MoveDirection.z not working?

Asked by 5 years ago

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)
0
KeyDown is deprecated, use UserInputService. User#19524 175 — 5y

Answer this question