Here a script!
LOCAL:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local rootpart = script.Parent.Parent:WaitForChild("HumanoidRootPart")
local animationController = game:GetService("Players").LocalPlayer.Character:WaitForChild("Humanoid"):WaitForChild("Animator")
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
--dash
local dashevent = game:GetService("ReplicatedStorage").Events.Dash
local animation = Instance.new("Animation")
--end
local animations = {
["DashFront"] = "rbxassetid://16566527703";
["DashLeft"] = "rbxassetid://16591663577";
["DashRight"] = "rbxassetid://16596178032";
["DashDown"] = "rbxassetid://16613175493";
}
local dashreload = false
local sidedashreload = false
local sidedashplaying = false
UIS.InputBegan:Connect(function(key, typing)
local humanoid = char:WaitForChild("Humanoid")
if humanoid.WalkSpeed == 0 or humanoid.WalkSpeed == 2 then return end
local dashanim = "Front"
if typing then return end
if key.KeyCode == Enum.KeyCode.Q then
local DHold = UIS:IsKeyDown(Enum.KeyCode.D)
local WHold = UIS:IsKeyDown(Enum.KeyCode.W)
local SHeld = UIS:IsKeyDown(Enum.KeyCode.S)
local AHeld = UIS:IsKeyDown(Enum.KeyCode.A)
if WHold == true then
dashanim = "Front"
end
if AHeld == true then
dashanim = "Left"
end
if DHold == true then
dashanim = "Right"
end
if SHeld == true then
dashanim = "Down"
end
animation.AnimationId = animations["Dash"..dashanim]
local dashanimationTrack = animationController:LoadAnimation(animation)
humanoid.WalkSpeed = 0
local Attachment = Instance.new("Attachment", rootpart)
local BV = Instance.new("BodyVelocity", Attachment)
if dashanim == "Front" then
if sidedashplaying == true then return end
if dashreload == true then humanoid.WalkSpeed = 21; Attachment:Destroy(); dashanimationTrack:Stop() return end
local playing = false
dashreload = true
BV.MaxForce = Vector3.new(math.huge,0,math.huge)
BV.P = 9e9
BV.Parent = rootpart
playing = true
local function velocity()
local connection
connection = RunService.Heartbeat:Connect(function()
BV.Velocity = rootpart.CFrame.LookVector * 1 * 55
if not playing then
connection:Disconnect()
end
end)
end
velocity()
task.wait(0.01)
dashanimationTrack:Play()
dashevent:FireServer(player)
dashevent.OnClientEvent:Connect(function(player, results)
BV:Destroy()
playing = false
Attachment:Destroy()
humanoid.WalkSpeed = 21
wait(5.5)
dashreload = false
end)
elseif dashanim == "Left" then
local playing = false
sidedashplaying = true
if sidedashreload == true then humanoid.WalkSpeed = 21 Attachment:Destroy() dashanimationTrack:Stop() return end
sidedashreload = true
BV.MaxForce = Vector3.new(math.huge,0,math.huge)
BV.P = 8e8
BV.Parent = rootpart
playing = true
local function velocity()
local connection
connection = RunService.Heartbeat:Connect(function()
BV.Velocity = rootpart.CFrame.LookVector * (rootpart.CFrame.RightVector * -1) * 65
if not playing then
connection:Disconnect()
end
end)
end
velocity()
dashanimationTrack:Play()
task.wait(0.3)
BV:Destroy()
Attachment:Destroy()
sidedashplaying = false
humanoid.WalkSpeed = 21
wait(3)
if sidedashreload ~= false then
sidedashreload = false
end
elseif dashanim == "Right" then
sidedashplaying = true
local playing = false
if sidedashreload == true then humanoid.WalkSpeed = 21 Attachment:Destroy() dashanimationTrack:Stop() return end
sidedashreload = true
BV.MaxForce = Vector3.new(math.huge,0,math.huge)
BV.P = 8e8
BV.Parent = rootpart
playing = true
local function velocity()
local connection
connection = RunService.Heartbeat:Connect(function()
BV.Velocity = rootpart.CFrame.RightVector * 1 * 65
if not playing then
connection:Disconnect()
end
end)
end
velocity()
dashanimationTrack:Play()
task.wait(0.3)
playing = false
BV:Destroy()
Attachment:Destroy()
sidedashplaying = false
humanoid.WalkSpeed = 21
wait(3)
if sidedashreload ~= false then
sidedashreload = false
end
elseif dashanim == "Down" then
local playing = false
if dashreload == true then Attachment:Destroy() humanoid.WalkSpeed = 21 dashanimationTrack:Stop() return end
dashreload = true
BV.MaxForce = Vector3.new(math.huge,0,math.huge)
BV.P = 8e8
BV.Parent = rootpart
playing = true
local function velocity()
local connection
connection = RunService.Heartbeat:Connect(function()
BV.Velocity = rootpart.CFrame.LookVector * -1 * 55
if not playing then
connection:Disconnect()
end
end)
end
velocity()
dashanimationTrack:Play()
task.wait(0.3)
playing = false
BV:Destroy()
Attachment:Destroy()
humanoid.WalkSpeed = 21
wait(3)
if sidedashreload ~= false then
sidedashreload = false
end
dashreload = false
end
end
end)
SERVER (Used for a front dash hitbox):
local dashevent = game:GetService("ReplicatedStorage").Events.Dash
local stun = require(game.ServerStorage.Module.StunHandlerV2)
local player = game.Players.LocalPlayer
--end
local hitanimations = {
["Dash1"] = game.ReplicatedStorage["Hitted combo"].Dash1;
}
dashevent.OnServerEvent:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
local rootpart = char:WaitForChild("HumanoidRootPart")
local hitbox = Instance.new("Part")
hitbox.Size = Vector3.new(3,3,3)
hitbox.Parent = rootpart
hitbox.CanCollide = false
hitbox.CFrame = rootpart.CFrame + (rootpart.CFrame.lookVector * 3.5)
hitbox.Transparency = 0
local weld = Instance.new("WeldConstraint", hitbox)
weld.Part0 = hitbox
weld.Part1 = hitbox.Parent
hitbox.Name = "Hitbox"
local humanoid = char:WaitForChild("Humanoid")
local results = nil
local checkcorrect = false
local blockresults = "bad"
local function check()
if hitbox.CanTouch == false then return end
hitbox.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local function hitted()
hitbox.CanTouch = false
local numberhit = 1
local enemy = hit.Parent:WaitForChild("HumanoidRootPart")
local enehum = hit.Parent:WaitForChild("Humanoid")
local animator = enehum.Animator
local animation = hitanimations["Dash"..numberhit]
local dashanimationTrack = animator:LoadAnimation(animation)
if animator then
dashanimationTrack:Play()
end
enehum:TakeDamage(4)
stun.Stun(enehum, 2)
checkcorrect = true
dashevent:FireClient(player, results)
end
if not rootpart:FindFirstChild("BlockHitbox") then hitted()
else
for v, part in pairs(rootpart.BlockHitbox) do
if part.Name == "Hitbox" then end
end
end
end
end)
end
repeat check() until hitbox.CanTouch == true or results == true
task.wait(0.6)
results = false
if results == false and checkcorrect ~= true then
dashevent:FireClient(player, results)
end
hitbox:Destroy()
humanoid.WalkSpeed = 21
end)
Is this everything is good?