I am trying to make a script so the player dashes when they press Q, this works just how I want it, exept when you jump and then dash you fall, i want to make the player not fall until the dash is complete.
local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local uis = game:GetService("UserInputService")
local i = 0
local anims = {script.Dash1,script.Dash2}
local cooldown = false
local cooldowntime = 0.7
uis.InputBegan:Connect(function(key)
if not cooldown then
if key.KeyCode == Enum.KeyCode.Q then
cooldown = true
i = 1-i
local playAnim = humanoid:LoadAnimation(anims[1+i])
playAnim:Play()
script.Sound:Play()
if humanoid:GetState() ~= Enum.HumanoidStateType.Freefall then
player.Character.HumanoidRootPart.Velocity = player.Character.HumanoidRootPart.CFrame.lookVector * 200
else
player.Character.HumanoidRootPart.Velocity = player.Character.HumanoidRootPart.CFrame.lookVector * 130
end
wait(cooldowntime)
cooldown = false
end
end
end)
(please ignore my bad code, this is what worked so i did it)