Advertisement
Dogletsuperstar

Dash Script

Sep 7th, 2023
2,620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.15 KB | None | 0 0
  1. local RS = game:GetService('ReplicatedStorage')
  2. local uis = game:GetService('UserInputService')
  3. local speed = 120
  4. local duration = .3
  5. local cooldown = 5
  6. local debounce = {}
  7.  
  8. RS.FlashStepDash.OnServerEvent:Connect(function(Player)
  9.     if debounce[Player] then return end
  10.     debounce[Player] = true
  11.    
  12.     local delete = {}
  13.     local Transparency = {}
  14.    
  15.     local character = Player.Character
  16.     local attachment = Instance.new('Attachment', character.HumanoidRootPart)
  17.     local LinearVelocity = Instance.new('LinearVelocity', character.HumanoidRootPart)
  18.    
  19.     delete[#delete + 1] = attachment
  20.     delete[#delete + 1] = LinearVelocity
  21.      
  22.     LinearVelocity.MaxForce = 300000
  23.     LinearVelocity.Attachment0 = attachment
  24.     LinearVelocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Line
  25.     if uis:IsKeyDown(Enum.KeyCode.A) then
  26.         LinearVelocity.LineDirection = Vector3.new(character.HumanoidRootPart.CFrame.LookVector.X, 0, character.HumanoidRootPart.CFrame.LookVector.Z.math.rad(270))
  27.         elseif uis:IsKeyDown(Enum.KeyCode.D) then
  28.             LinearVelocity.LineDirection = Vector3.new(character.HumanoidRootPart.CFrame.LookVector.X, 0, character.HumanoidRootPart.CFrame.LookVector.Z.math.rad(90))
  29.             elseif uis:IsKeyDown(Enum.KeyCode.S) then
  30.                 LinearVelocity.LineDirection = Vector3.new(character.HumanoidRootPart.CFrame.LookVector.X, 0, character.HumanoidRootPart.CFrame.LookVector.Z.math.rad(180))
  31.                 elseif uis:IsKeyDown(Enum.KeyCode.W) then
  32.                     LinearVelocity.LineDirection = Vector3.new(character.HumanoidRootPart.CFrame.LookVector.X, 0, character.HumanoidRootPart.CFrame.LookVector.Z)
  33.                 end
  34.            
  35.     LinearVelocity.LineVelocity = speed
  36.    
  37.     local Particle = RS.BlackFlash
  38.     local ClonedParticle =Particle:Clone()
  39.     ClonedParticle.Parent = character.HumanoidRootPart
  40.     delete[#delete+1] = ClonedParticle
  41.    
  42.     for Index,Value in pairs(character:GetDescendants()) do
  43.         if not Value:IsA('BasePart') then continue end
  44.         Transparency[Value] = Value.Transparency
  45.         Value.Transparency = 1 
  46.     end
  47.    
  48.     wait(duration)
  49.    
  50.     for i,v in pairs(Transparency) do
  51.         i.Transparency = v
  52.     end
  53.     for i, v in pairs(delete) do
  54.         v:Destroy()
  55.         delete[i] = nil
  56.     end
  57.     wait(cooldown)
  58.     debounce[Player] = nil
  59. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement