Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local repstorage = game:GetService("ReplicatedStorage")
- local Events = repstorage.Events
- local anims = script.Animations
- local module = {}
- local dashDebounces = {}
- local DashEnergy = 30
- Events.Dash.OnServerEvent:Connect(function(player)
- if(player.Energy.value - DashEnergy) < 0 then
- return
- end
- if dashDebounces[player] then
- return
- end
- local character = player.Character or player.CharacterAdded:Wait()
- if character == nil then
- return
- end
- local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
- local humanoid = character:FindFirstChild("Humanoid")
- if humanoid == nil then
- return
- end
- if humanoidRootPart == nil or humanoid.Health == 0 then
- return
- end
- dashDebounces[player] = true
- player.Energy.Value -= DashEnergy
- local dashanim = humanoid.Animator:LoadAnimation(anims.Dash)
- dashanim:Play()
- local dashTrail = script.DashTrail:Clone()
- dashTrail.Parent = character.UpperTorso
- dashTrail.Attachment0 = character.LowerTorso.WaistBackAttachment
- dashTrail.Attachment1 = character.Head.NeckRigAttachment
- local vectorForce: VectorForce = Instance.new("VectorForce")
- vectorForce.Attachment0 = humanoidRootPart.RootRigAttachment
- vectorForce.Force = humanoidRootPart.CFrame.LookVector * 15000
- vectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
- vectorForce.Parent = humanoidRootPart
- task.delay(0.5, function()
- dashTrail:Destroy()
- dashanim:Stop()
- end)
- task.delay(0.2, function()
- vectorForce:Destroy()
- end)
- task.wait(1)
- if dashDebounces[player] then
- dashDebounces[player] = nil
- end
- task.delay(4, function()
- for i = 1, DashEnergy do
- player.Energy.Value = math.min(100, player.Energy.Value + 1)
- task.wait(5/DashEnergy)
- end
- end)
- end)
- return module
Advertisement
Add Comment
Please, Sign In to add comment