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

How to make a W A S D dash system?

Asked by 1 year ago
Edited by T3_MasterGamer 1 year ago

I want to make a WASD Dash System however all the things I tried didn't work. I already have created animations for ASD and I want no animations for W. All I want is a simple teleport into your direction and set the animation based on it. It would also be great if it would have I-Frames.

I saved the animations into a folder called "Dash" in ReplicatedStorage. The names are DashL, DashR and DashB, for Left, Right and Back respectively.

I also want to implement some anime teleport particles (like this: https://tenor.com/view/teleportation-goku-dragon-ball-z-super-saiyan-dbz-gif-17300403) . They are going to be just simple particles eminating from the player. Nothing special.

Here is the code I tried using. Instead of teleporting, it just gives a speed boost.

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")

local DashL = Humanoid:LoadAnimation(ReplicatedStorage.Dash.DashL)
local DashR = Humanoid:LoadAnimation(ReplicatedStorage.Dash.DashR)
local DashB = Humanoid:LoadAnimation(ReplicatedStorage.Dash.DashB)

local Properties = {
    Velocity = 50,
    Duration = 1,
    Keybind = Enum.KeyCode.Q,
    LastDash = tick(),
    Cooldown = 1,
}

UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
    if Input.KeyCode == Properties.Keybind then

        if tick() - Properties.LastDash >= Properties.Cooldown then
            Properties.LastDash = tick()

            if Input.KeyCode == Input.KeyCode.A then
                DashL:Play() elseif Input.KeyCode == Input.KeyCode.D then
                                        DashR:Play() elseif Input.KeyCode == Input.KeyCode.B then
                                                                DashB:Play() end



            local BodyVelocity = Instance.new("BodyVelocity")
            BodyVelocity.MaxForce = Vector3.new(1,1,1) * 500000
            BodyVelocity.Velocity = Character.HumanoidRootPart.CFrame.LookVector * Properties.Velocity
            BodyVelocity.Parent = Character.HumanoidRootPart

            wait(Properties.Duration)
            BodyVelocity:Destroy()
        end

    end
end)
0
We can't make a whole script for you but if you could show the script that failed we could help. Puppy_lovertheawsome 84 — 1y

Answer this question