This may seem mind-boggling to a few of you, so I'll explain this as well as I can.... Here's My Script:

local player = game.Players.LocalPlayer ---Get The Player

local Char = player.Character or player.CharacterAdded:Wait() -- Get player character
local UIS = game:GetService("UserInputService") -- Irrelevant, seeing as I didn't use UIS--
local humanoid = player.Character:WaitForChild("Humanoid") -- Waits for human to load
local context = game:GetService("ContextActionService") -- Required

local debounce = false -- Debounce
local cooldown = 1 -- Time to wait between 2 dash -- Cooldown between each dash

local anim = Instance.new("Animation") -- Creates anim to be played when dashing
anim.AnimationId = "http://www.roblox.com/asset/?id=5311749838"--My own anim--

local function Onbuttonpress() -- Function for contextactionservice(REQUIRED)--


        if debounce == false then --Condition--
            debounce = true -- Set debounce to true--
            local playAnim = humanoid:LoadAnimation(anim) -- Load anim
            playAnim:Play() -- Play anim 
            local Character = game.Workspace:WaitForChild(player.Name) --Oops, redifining--
            Char.HumanoidRootPart.Velocity = Char.HumanoidRootPart.CFrame.lookVector*500
            local Trail1 = Instance.new("Trail",Character) --Trails--
            Trail1.Attachment0 = Character.RightFoot:FindFirstChildOfClass("Attachment")
            Trail1.Attachment1 = Character.RightLowerLeg:FindFirstChildOfClass("Attachment")
            Trail1.Lifetime = 0.2
            Trail1.MaxLength = 1
            Trail1.WidthScale = NumberSequence.new(0.8)
            Trail1.FaceCamera = false
            local Trail2 = Instance.new("Trail",Character)
            Trail2.Attachment0 = Character.LeftFoot:FindFirstChildOfClass("Attachment")
            Trail2.Attachment1 = Character.LeftLowerLeg:FindFirstChildOfClass("Attachment")
            Trail2.Lifetime = 0.2
            Trail2.MaxLength = 0.5
            Trail2.WidthScale = NumberSequence.new(0.8)
            Trail2.FaceCamera = false
            local Trail3 = Instance.new("Trail",Character)
            Trail3.Attachment0 = Character.LeftLowerArm:FindFirstChildOfClass("Attachment")
            Trail3.Attachment1 = Character.LeftHand:FindFirstChildOfClass("Attachment")
            Trail3.Lifetime = 0.2
            Trail3.MaxLength = 0.5
            Trail3.WidthScale = NumberSequence.new(0.8)
            Trail3.FaceCamera = false
            local Trail4 = Instance.new("Trail",Character)
            Trail4.Attachment0 = Character.RightLowerArm:FindFirstChildOfClass("Attachment")
            Trail4.Attachment1 = Character.RightHand:FindFirstChildOfClass("Attachment")
            Trail4.Lifetime = 0.25
            Trail4.MaxLength = 0.5
            Trail4.WidthScale = NumberSequence.new(0.8)
            Trail4.FaceCamera = false
            local Trail5 = Instance.new("Trail",Character)
            Trail5.Attachment0 = Character.UpperTorso:FindFirstChildOfClass("Attachment")
            Trail5.Attachment1 = Character.LowerTorso:FindFirstChildOfClass("Attachment")
            Trail5.Lifetime = 0.25
            Trail5.MaxLength = 0.5
            Trail5.WidthScale = NumberSequence.new(0.8)
            Trail5.FaceCamera = false
            wait(.5)
            for i = 0,1, .1 do
                Trail1.Transparency = NumberSequence.new(i)
                Trail2.Transparency = NumberSequence.new(i)
                Trail3.Transparency = NumberSequence.new(i)
                Trail4.Transparency = NumberSequence.new(i)
                Trail5.Transparency = NumberSequence.new(i)
                wait()
            end
            Trail1:Destroy()
            Trail2:Destroy()
            Trail3:Destroy()
            Trail4:Destroy()
            Trail5:Destroy()
            wait(cooldown)
            debounce = false

    end
    end
---Creates A Button For Mobile User--
context:BindAction("Startdash", Onbuttonpress, true, "q")
context:SetTitle("Startdash", "Dash")
context:SetPosition("Onbuttonpress", UDim2.new(0.628, 0,0.767, 0))



It's a lot isn't it. The thing is it works! It plays an animation and moves the player towards the direction they are looking at but I want to add something extra to this.... How would I make it so anyone in contact with the player while the player is dashing takes damage? And if possible, how could I include effects when this happens... For Example, The player hit ragdolls?(You don't have to answer the last part, it would be helpful if you did though. Help Really is much appreciated. For those still confused, I've put notes on the code. (Most of it is just the creation of the trail). (:

2 comments

0

Use humanoid.Touched from the player that is using the dash, Connect when dashing, disconnect when not

0

Ye but how would i put this into my script?