Advertisement
Aquarius_Raverus

stest

Sep 2nd, 2020
1,959
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.89 KB | None | 0 0
  1. function ray2(startpos, endpos, dis, partt)
  2.     local test = Ray.new(startpos, CFrame.new(startpos, endpos).lookVector * dis)
  3.     local hit, pos, sf = game.Workspace:FindPartOnRay(test, partt)
  4.     return hit, pos, sf
  5. end
  6.  
  7. wallup = false
  8.  
  9. local treejumping = false
  10.  
  11. function wallrun(value)
  12.     if treejumping then return end
  13.     if value then
  14.         if ActionConditions() or Character:FindFirstChild("Shunpo") then return end
  15.         local n = (#Player:FindFirstChild("CombatTags"):GetChildren() > 0)
  16.         if n and Humanoid.Health < Humanoid.MaxHealth/2 then return end
  17.         if inair == true and Humanoid.Health > Humanoid.MaxHealth * 0.3 and not Root:findFirstChild("WallRun") then
  18.             if not Root:findFirstChild("WallRun") then
  19.                 ra = nil
  20.                 flyang = 0
  21.                 flydir = ""
  22.                 sfnom = Vector3.new(0, 0, 0)
  23.                 right_ray, useless, sf = ray2(Root.Position, Root.Position + (Root.CFrame * CFrame.Angles(0, math.rad(90), 0)).lookVector, 3, Character)
  24.                 if right_ray and right_ray.Transparency ~= 1 and right_ray.Name ~= "NoClimb" then
  25.                     ra = right_ray
  26.                     flyang = 90
  27.                     flydir = "right"
  28.                     sfnom = sf
  29.                 end
  30.                 left_ray, useless, sf = ray2(Root.Position, Root.Position + (Root.CFrame * CFrame.Angles(0, math.rad(-90), 0)).lookVector, 3, Character)
  31.                 if left_ray and left_ray.Transparency ~= 1 and left_ray.Name ~= "NoClimb" then
  32.                     ra = left_ray
  33.                     flyang = -90
  34.                     flydir = "left"
  35.                     sfnom = sf
  36.                 end
  37.                 forward_ray, useless, sf = ray2(Root.Position, Root.Position + (Root.CFrame * CFrame.Angles(0, math.rad(0), 0)).lookVector, 4, Character)
  38.                 if forward_ray and forward_ray.Transparency ~= 1 and forward_ray.Name ~= "NoClimb" then
  39.                     ra = forward_ray
  40.                     flyang = 0
  41.                     flydir = "forward"
  42.                     sfnom = sf
  43.                 end
  44.                 if ra and ra.Transparency ~= 1 and ra.Name ~= "NoClimb" then
  45.                     bv = Instance.new("BodyVelocity")
  46.                     bv.maxForce = Vector3.new(0, 10000000, 0)
  47.                     bv.Parent = Root
  48.                     if runanim ~= nil then
  49.                         runanim:Stop()
  50.                     end
  51.                     runanim = Humanoid:LoadAnimation(script.Animations.Movement.FlyUp)
  52.                     if flydir == "right" then
  53.                         bv.maxForce = Vector3.new(10000000, 10000000, 10000000)
  54.                         runanim = Humanoid:LoadAnimation(script.Animations.Movement.FlyLeft)
  55.                     elseif flydir == "left" then
  56.                         bv.maxForce = Vector3.new(10000000, 10000000, 10000000)
  57.                         runanim = Humanoid:LoadAnimation(script.Animations.Movement.FlyRight)
  58.                     end
  59.                     runanim:Play()
  60.                     if flydir == "forward" then
  61.                         if Character.Torso.Transparency == 1 then
  62.                             bv.velocity = Vector3.new(0, 60, 0)
  63.                         else
  64.                             bv.velocity = Vector3.new(0, 30, 0)
  65.                         end
  66.                     else
  67.                         if Character.Torso.Transparency == 1 then
  68.                             bv.velocity = (CFrame.new(ra.Position, ra.Position + sfnom) * CFrame.Angles(0, math.rad(flyang), 0)).lookVector * 60
  69.                         else
  70.                             bv.velocity = (CFrame.new(ra.Position, ra.Position + sfnom) * CFrame.Angles(0, math.rad(flyang), 0)).lookVector * 30
  71.                         end
  72.                         Root.CFrame = CFrame.new(Root.Position, Root.Position + bv.velocity)
  73.                     end
  74.                     bv.Name = "WallRun"
  75.                     bv.Parent = Root
  76.                     wallup = true
  77.                     canDoubleJump = true
  78.                     sub(function()
  79.                         while true do
  80.                             RunService.Heartbeat:wait()
  81.                             ra = ray2(Root.Position, Root.Position + (Root.CFrame * CFrame.Angles(0, math.rad(flyang), 0)).lookVector, 4, Character)
  82.                             if ra and ra.Transparency ~= 1 and ra.Name ~= "NoClimb" then
  83.                             else
  84.                                 bv:Destroy()
  85.                                 --print("stop")
  86.                                 wallup = false
  87.                                 if runanim ~= nil then
  88.                                     runanim:Stop()
  89.                                 end
  90.                                 break
  91.                             end
  92.                         end
  93.                     end)
  94.                 else
  95.                     if canDoubleJump == true and Humanoid.Health >= Humanoid.MaxHealth * 0.3 then
  96.                         canDoubleJump = false
  97.                         --Character.Torso.Velocity = Character.Torso.Velocity * Vector3.new(1, 0, 1) + Vector3.new(0, 50, 0)
  98.                        
  99.                         if runanim ~= nil then
  100.                             runanim:Stop()
  101.                         end
  102.                         --runanim = Humanoid:LoadAnimation(script.Animations.Movement.Flip)
  103.                         --runanim:Play()
  104.                     else
  105.                     end
  106.                 end
  107.             end
  108.         elseif Root:findFirstChild("WallRun") then
  109.             bv.maxForce = Vector3.new(10000000, 10000000, 10000000)
  110.             if runanim ~= nil then
  111.                 runanim:Stop()
  112.             end
  113.             runanim = Humanoid:LoadAnimation(script.Animations.Movement.Flip)
  114.             runanim:Play()
  115.             if flydir == "forward" then
  116.                 Root.WallRun.velocity = Vector3.new(0, 50, 0) + Root.CFrame.lookVector * -30
  117.                 Root.WallRun.velocity = Root.CFrame.lookVector * 50 + CFrame.new(ra.Position, ra.Position + sfnom).lookVector * 40
  118.             end
  119.         end
  120.     else
  121.         wallup = false
  122.         --print("stop")
  123.         if Root:FindFirstChild("WallRun") then
  124.             Root:FindFirstChild("WallRun"):Destroy()
  125.         end
  126.         if runanim ~= nil then
  127.             runanim:Stop()
  128.         end
  129.     end
  130. end
  131.  
  132.  
  133. function lock(part)
  134.     if part and part:IsA("BasePart") then
  135.         part.LocalTransparencyModifier = part.Transparency
  136.         part.Changed:connect(function (property)
  137.             part.LocalTransparencyModifier = part.Transparency
  138.         end)
  139.     end
  140. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement