I’m trying to make a dash system. You can dash in your moving direction and every direction has its own animation.
Here is the script I have right now:
local Keybind = Enum.KeyCode.Q
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local UIS = game:GetService("UserInputService")
local DashTime = .2
local Force = 70
local Anims = {
["Left"] = Animator:LoadAnimation(script.Animations:WaitForChild("Left")),
["Right"] = Animator:LoadAnimation(script.Animations:WaitForChild("Right")),
["Foward"] = Animator:LoadAnimation(script.Animations:WaitForChild("Forward")),
["Back"] = Animator:LoadAnimation(script.Animations:WaitForChild("Back"))
}
UIS.InputBegan:Connect(function(Key)
if Key.KeyCode == Keybind then
local Slide = Instance.new("BodyVelocity")
Slide.MaxForce = Vector3.new(1,0,1) * 30000
Slide.Velocity = Humanoid.MoveDirection * Force
Slide.Parent = Character.HumanoidRootPart
wait(DashTime)
game.Debris:AddItem(Slide, 0.1)
for count = 1, 2 do
wait(0.05)
Slide.Velocity *= 0.3
end
end
end)
I found out how to create the dash, however i dont know how i would implement the animations.