So when i jump and press q my character dash but float
i use LinearVelocity
local animtable = {
run = Humanoid:WaitForChild("Animator"):LoadAnimation(ReplicatedStorage.Animations.Movement.Run),
ForwadDash = Humanoid:WaitForChild("Animator")
:LoadAnimation(ReplicatedStorage.Animations.Movement:WaitForChild("Foward Dash")),
BackDash = Humanoid:WaitForChild("Animator"):LoadAnimation(ReplicatedStorage.Animations.Movement.BackDash),
LeftDash = Humanoid:WaitForChild("Animator"):LoadAnimation(ReplicatedStorage.Animations.Movement.LeftDash),
RightDash = Humanoid:WaitForChild("Animator"):LoadAnimation(ReplicatedStorage.Animations.Movement.RightDash),
}
local function DeadMove()
Humanoid.WalkSpeed = 0
Humanoid.UseJumpPower = true
Humanoid.JumpPower = 0
end
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.Q and cooldown == false then
cooldown = true
local attachment = Instance.new("Attachment", Character:FindFirstChild("HumanoidRootPart"))
local linearvelocity = Instance.new("LinearVelocity", Character:FindFirstChild("HumanoidRootPart"))
linearvelocity.MaxForce = 10000
linearvelocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
linearvelocity.Attachment0 = attachment
linearvelocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
attachment.WorldPosition = Character:FindFirstChild("HumanoidRootPart").AssemblyCenterOfMass
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
IsDashing.Value = true
DeadMove()
animtable.ForwadDash:Play()
linearvelocity.VectorVelocity = Vector3.new(0, 0, -40)
animtable.ForwadDash.Stopped:Wait()
IsDashing.Value = false
if isrunning.Value and Humanoid.MoveDirection.Magnitude > 0 then
BackRunning.Value = true
end
elseif UserInputService:IsKeyDown(Enum.KeyCode.S) then
IsDashing.Value = true
DeadMove()
animtable.BackDash:Play()
linearvelocity.VectorVelocity = Vector3.new(0, 0, 30)
animtable.BackDash.Stopped:Wait()
IsDashing.Value = false
if isrunning.Value and Humanoid.MoveDirection.Magnitude > 0 then
BackRunning.Value = true
end
elseif UserInputService:IsKeyDown(Enum.KeyCode.A) then
IsDashing.Value = true
DeadMove()
animtable.RightDash:Play()
linearvelocity.VectorVelocity = Vector3.new(-50, 0, 0)
animtable.RightDash.Stopped:Wait()
IsDashing.Value = false
if isrunning.Value and Humanoid.MoveDirection.Magnitude > 0 then
BackRunning.Value = true
end
elseif UserInputService:IsKeyDown(Enum.KeyCode.D) then
IsDashing.Value = true
DeadMove()
animtable.LeftDash:Play()
linearvelocity.VectorVelocity = Vector3.new(50, 0, 0)
animtable.LeftDash.Stopped:Wait()
IsDashing.Value = false
if isrunning.Value and Humanoid.MoveDirection.Magnitude > 0 then
BackRunning.Value = true
end
else
IsDashing.Value = true
DeadMove()
animtable.BackDash:Play()
linearvelocity.VectorVelocity = Vector3.new(0, 0, 30)
animtable.BackDash.Stopped:Wait()
IsDashing.Value = false
if isrunning.Value and Humanoid.MoveDirection.Magnitude > 0 then
BackRunning.Value = true
end
end