Advertisement
iLoveTapWater

Untitled

Nov 23rd, 2022
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RBScript 6.15 KB | Source Code | 0 0
  1. local player = game.Players.LocalPlayer
  2. local char = player.Character
  3. local Hum = char:WaitForChild("Humanoid")
  4.  
  5.  
  6. local Datastats = char:WaitForChild("DataStats")
  7. local Stamina = Datastats:WaitForChild("Stamina")
  8.  
  9. local DashTime = .9
  10. local Force = 40000
  11. local Power = 20
  12.  
  13. local StamCost = 10
  14.  
  15. local CD = .5
  16. local DashDB = false
  17.  
  18. local CurrentWalkSpeed = 16
  19. local RunningWalkSpeed = 25
  20.  
  21. local RunS = game:GetService("RunService")
  22. local UIS = game:GetService("UserInputService")
  23.  
  24. local Stuns = require(game.ReplicatedStorage.Combat:WaitForChild('Stuns'))
  25. local Values = require(game.ReplicatedStorage.Combat:WaitForChild('Values'))
  26.  
  27. local WKeyDown = false
  28. local AKeyDown = false
  29. local SKeyDown = false
  30. local DKeyDown = false
  31.  
  32. local NoKeyDown = true
  33.  
  34. local function Dirt()
  35.    
  36.     local raycastParams = RaycastParams.new()
  37.     raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
  38.     raycastParams.FilterDescendantsInstances = {char}
  39.     raycastParams.IgnoreWater = true
  40.  
  41.     local RayOrigin = char.HumanoidRootPart.Position
  42.     local RayDirection = Vector3.new(0,-1,0) * 10
  43.     local NewRay = workspace:Raycast(RayOrigin,RayDirection,raycastParams)
  44.  
  45.     if NewRay then
  46.         local Dirt = script:WaitForChild("Dirt"):Clone()
  47.         Dirt.Parent = workspace
  48.         Dirt.Position = NewRay.Position
  49.         print(NewRay.Instance.Name)
  50.         local trueColor = NewRay.Instance.Color
  51.         Dirt:WaitForChild("Attachment"):WaitForChild("Smoke").Color = ColorSequence.new{           
  52.             ColorSequenceKeypoint.new(0,trueColor),
  53.             ColorSequenceKeypoint.new(1,trueColor),            
  54.         }
  55.         Dirt:WaitForChild("Attachment"):WaitForChild("Smoke"):Emit(30)
  56.         game.Debris:AddItem(Dirt,1.1)
  57.  
  58.     end
  59. end
  60.  
  61. function DashFoward()
  62.     local Dash = Hum:LoadAnimation(script:WaitForChild("ForwardDash"))
  63.     local BV = Instance.new("BodyVelocity",char.Torso)
  64.     BV.MaxForce = Vector3.new(Force,0,Force)
  65.     BV.Velocity = char.HumanoidRootPart.CFrame.lookVector * Power
  66.     game.Debris:AddItem(BV,DashTime)
  67.     Dash:Play()
  68.     Dash:AdjustSpeed(1.5)
  69.    
  70.    
  71.  
  72.  
  73.     Dirt()
  74.     Hum.WalkSpeed = 0
  75.     local direction = coroutine.wrap(function()
  76.         local Runservice = RunS.Stepped:Connect(function()
  77.             BV.Velocity = char.HumanoidRootPart.CFrame.lookVector * Power
  78.         end)
  79.        
  80.         wait(DashTime)
  81.         Runservice:disconnect()
  82.         if char:FindFirstChild("Running") then
  83.             Hum.WalkSpeed = RunningWalkSpeed
  84.         else
  85.             Hum.WalkSpeed = CurrentWalkSpeed
  86.             end
  87.     end)()
  88. end
  89.  
  90. function DashBack()
  91.     local Dash = Hum:LoadAnimation(script:WaitForChild("BackwardDash"))
  92.     local BV = Instance.new("BodyVelocity",char.Torso)
  93.     BV.MaxForce = Vector3.new(Force,0,Force)
  94.     BV.Velocity = char.HumanoidRootPart.CFrame.lookVector * -Power
  95.     game.Debris:AddItem(BV,DashTime)
  96.     Dash:Play()
  97.     Dash:AdjustSpeed(1.5)
  98.  
  99.  
  100.     Dirt()
  101.     Hum.WalkSpeed = 0
  102.     local direction = coroutine.wrap(function()
  103.         local Runservice = RunS.Stepped:Connect(function()
  104.             BV.Velocity = char.HumanoidRootPart.CFrame.lookVector * -Power
  105.         end)
  106.         wait(DashTime)
  107.         Runservice:disconnect()
  108.         if char:FindFirstChild("Running") then
  109.             Hum.WalkSpeed = RunningWalkSpeed
  110.         else
  111.             Hum.WalkSpeed = CurrentWalkSpeed
  112.         end
  113.     end)()
  114. end
  115.  
  116. function DashLeft()
  117.     local Dash = Hum:LoadAnimation(script:WaitForChild("LeftDash"))
  118.     local BV = Instance.new("BodyVelocity",char.Torso)
  119.     BV.MaxForce = Vector3.new(Force,0,Force)
  120.     BV.Velocity = char.HumanoidRootPart.CFrame.RightVector * -Power
  121.     game.Debris:AddItem(BV,DashTime)
  122.     Dash:Play()
  123.     Dash:AdjustSpeed(1.5)
  124.  
  125.     Dirt()
  126.     Hum.WalkSpeed = 0
  127.  
  128.     local direction = coroutine.wrap(function()
  129.         local Runservice = RunS.Stepped:Connect(function()
  130.             BV.Velocity = char.HumanoidRootPart.CFrame.RightVector * -Power
  131.         end)
  132.         wait(DashTime)
  133.         Runservice:disconnect()
  134.         if char:FindFirstChild("Running") then
  135.             Hum.WalkSpeed = RunningWalkSpeed
  136.         else
  137.             Hum.WalkSpeed = CurrentWalkSpeed
  138.         end
  139.     end)()
  140. end
  141.  
  142. function DashRight()
  143.     local Dash = Hum:LoadAnimation(script:WaitForChild("RightDash"))
  144.     local BV = Instance.new("BodyVelocity",char.Torso)
  145.     BV.MaxForce = Vector3.new(Force,0,Force)
  146.     BV.Velocity = char.HumanoidRootPart.CFrame.RightVector * Power
  147.     game.Debris:AddItem(BV,DashTime)
  148.     Dash:Play()
  149.     Dash:AdjustSpeed(1.5)
  150.  
  151.     Dirt()
  152.     Hum.WalkSpeed = 0
  153.  
  154.     local direction = coroutine.wrap(function()
  155.         local Runservice = RunS.Stepped:Connect(function()
  156.             BV.Velocity = char.HumanoidRootPart.CFrame.RightVector * Power
  157.         end)
  158.         wait(DashTime)
  159.         Runservice:disconnect()
  160.         if char:FindFirstChild("Running") then
  161.             Hum.WalkSpeed = RunningWalkSpeed
  162.         else
  163.             Hum.WalkSpeed = CurrentWalkSpeed
  164.         end
  165.     end)()
  166. end
  167.  
  168. UIS.InputBegan:Connect(function(input,istyping)
  169.    
  170.     for i,v in pairs(Stuns) do
  171.         if game.Players.LocalPlayer.Character:FindFirstChild(v) then return end
  172.     end
  173.    
  174.     if game.Players.LocalPlayer.Character:FindFirstChild("Blocking") then return end
  175.    
  176.     if istyping then return end
  177.     if Stamina.Value - StamCost < 0 then return end
  178.    
  179.     if input.KeyCode == Enum.KeyCode.Q and DashDB == false then
  180.         DashDB = true
  181.         delay(CD,function()
  182.             DashDB = false
  183.         end)
  184.        
  185.         Stamina.Value -= StamCost
  186.        
  187.         Values:CreateValue("BoolValue",player.Character,"Dashing",false,.3)
  188.        
  189.         local DashSound = script:WaitForChild("DashSound"):Clone()
  190.         DashSound.Parent = char:WaitForChild("HumanoidRootPart")
  191.         DashSound:Play()
  192.         game.Debris:AddItem(DashSound,1)
  193.        
  194.         if UIS.MouseBehavior == Enum.MouseBehavior.LockCenter then
  195.         if NoKeyDown == true or WKeyDown == true then
  196.                 DashFoward()
  197.                 return
  198.         end
  199.         if AKeyDown == true then
  200.                 DashLeft()
  201.                 return
  202.         end
  203.         if SKeyDown == true then
  204.                 DashBack()
  205.                 return
  206.         end
  207.         if DKeyDown == true then
  208.                 DashRight()
  209.                 return
  210.         end
  211.         else
  212.             DashFoward()
  213.             return
  214.         end
  215.         end
  216. end)
  217.  
  218.  
  219. RunS.Heartbeat:Connect(function()
  220.     if UIS:IsKeyDown(Enum.KeyCode.W) then
  221.         WKeyDown = true
  222.     else
  223.         WKeyDown = false
  224.     end
  225.     if UIS:IsKeyDown(Enum.KeyCode.A) then
  226.         AKeyDown = true
  227.     else
  228.         AKeyDown = false
  229.     end
  230.     if UIS:IsKeyDown(Enum.KeyCode.S) then
  231.         SKeyDown = true
  232.     else
  233.         SKeyDown = false
  234.     end
  235.     if UIS:IsKeyDown(Enum.KeyCode.D) then
  236.         DKeyDown = true
  237.     else
  238.         DKeyDown = false
  239.     end
  240.     if WKeyDown == false and AKeyDown == false and SKeyDown == false and DKeyDown == false then
  241.         NoKeyDown = true
  242.     else
  243.         NoKeyDown = false
  244.     end
  245. end)
  246.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement