#How do I set the Y velocity of the player during a dash script

11 messages · Page 1 of 1 (latest)

grim silo
#

I have a script for the player to dash, but I only want the dash to happen in the X direction. Currently, whenever the dash happens, it still conserves the Y velocity and lets the player dash upwards. So how would I set only the Y velocity to 0 when that happens so it only dashes straight forward?

abstract imp
#

What are you using for velocity?

grim silo
# abstract imp What are you using for velocity?
if moveDirection == Vector3.new(0,0,0) then -- if player is not currently moving/walking
                dashDirection = HRP.Position + Vector3.new(lookVector.X, 0 , 0)
            else -- if player are currently moving/walking
                dashDirection = HRP.Position + Vector3.new(moveDirection.X, 0, 0)
            end
grim silo
wicked wren
#

dashDirection = HRP.Position + Vector3.new(lookVector.X,3,0)

#

it'll add 3 to the Y direction

grim silo
#

so that will set the y velocity to 0?
(I forgot to mention that the script only allows dashing when jumping, so if you jump and dash, it can send you upwards)

#

and if dashing while falling you will dash downward/diagonally too

#

studio** You are now Level 1! **studio

fervent sonnet
#

Hi

grim silo
#

SOLVED
I used lua HumanoidRootPart.Velocity = Vector3.yAxis