Advertisement
HenloMyDude

local parkour script

Nov 5th, 2019
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.45 KB | None | 0 0
  1.  
  2. print([[how to use:
  3. 1. Hold shift and run lookin straight at the wall (not camera looking at the wall)
  4. 2. Jump and while in air press spacebar again to connect to wall.
  5. 3. To get to next wall jump and press spacebar before you hit the other wall.
  6. 4. Press g to do a dive.
  7. ]])
  8.  
  9. local player = game.Players.LocalPlayer
  10. local mouse = player:GetMouse()
  11. local cam = workspace.CurrentCamera
  12. repeat wait() until player.Character
  13. local char = player.Character
  14. wait(1)
  15. local gp
  16. local Torsoz = char:findFirstChild("Torso")
  17. local RA = char:findFirstChild("Right Arm")
  18. local LA = char:findFirstChild("Left Arm")
  19. local RL = char:findFirstChild("Right Leg")
  20. local LL = char:findFirstChild("Left Leg")
  21. local H = char:findFirstChild("Head")
  22. local Hu = char:findFirstChild("Humanoid")
  23. local RS = Torsoz:findFirstChild("Right Shoulder")
  24. local LS = Torsoz:findFirstChild("Left Shoulder")
  25. local RH = Torsoz:findFirstChild("Right Hip")
  26. local LH = Torsoz:findFirstChild("Left Hip")
  27. local N = Torsoz:findFirstChild("Neck")
  28. local NV = Vector3.new(0,0,0)
  29. local FOV = 90
  30. local Shift, Space, Sitting = false,false,false
  31. local GravPoint = 0
  32. local Diving = false
  33. local DivingCooldown = 0
  34. local DivingDir = NV
  35. local DivingCF = CFrame.new(0,0,0)
  36. local DivingBG, DivingBV
  37. local HWallRunning = false
  38. local HWRGravDrop = false
  39. local HWRLastPart
  40. local HWRCooldown = 0
  41. local HWRDir
  42. local VWallRunning = false
  43. local VWRLastPart
  44. local VWRCooldown = 0
  45. local VWRLeft,VWRRight = false,false
  46. local Sliding = false
  47. local SlideCooldown = 0
  48. local Standing = true
  49. local Action = "Standing"
  50. local animplus = true
  51. local animspeed = 0
  52. local animangle = 0.01
  53. local Joint1, Joint2, Joint3, Joint4, Joint5
  54.  
  55. for i, v in pairs(char:children()) do
  56. if (v.className == "LocalScript" and v.Name == "ParkourSkrip") or v.className == "NumberValue" or v.className == "BoolValue" or v.className == "Model" or v.Name == "Animate" then
  57. v:remove()
  58. end
  59. end
  60.  
  61. local loadids = {112474909, 112474911, 112474909}
  62.  
  63. local stamina = 250
  64. local maxstamina = 250
  65. local defsprint = 32
  66. local sprint = defsprint
  67.  
  68. local pause = Instance.new("BoolValue", char)
  69. pause.Name = "Pause"
  70. pause.Value = false
  71. local flow = Instance.new("NumberValue", char)
  72. flow.Name = "Flow"
  73. flow.Value = 0
  74. local flowcooldown = 0
  75.  
  76. local m = Instance.new("Model", char)
  77. m.Name = "FlowChainPartz"
  78.  
  79. local P = Instance.new("Part")
  80. P.Name = "TrailPart"
  81. P.formFactor = "Custom"
  82. P.Size = Vector3.new(0.2,0.2,0.2)
  83. P.Locked = true
  84. P.Anchored = true
  85. P.CanCollide = false
  86. P.TopSurface = 0
  87. P.BottomSurface = 0
  88.  
  89. script.Name = "ParkourSkrip"
  90.  
  91. local hue = 0
  92.  
  93. function HSV(H,S,V)
  94. H = H % 360
  95. local C = V * S
  96. local H2 = H/60
  97. local X = C * (1 - math.abs((H2 %2) -1))
  98. local color = Color3.new(0,0,0)
  99. if H2 <= 0 then
  100. color = Color3.new(C,0,0)
  101. elseif 0 <= H2 and H2 <= 1 then
  102. color = Color3.new(C,X,0)
  103. elseif 1 <= H2 and H2 <= 2 then
  104. color = Color3.new(X,C,0)
  105. elseif 2 <= H2 and H2 <= 3 then
  106. color = Color3.new(0,C,X)
  107. elseif 3 <= H2 and H2 <= 4 then
  108. color = Color3.new(0,X,C)
  109. elseif 4 <= H2 and H2 <= 5 then
  110. color = Color3.new(X,0,C)
  111. elseif 5 <= H2 and H2 <= 6 then
  112. color = Color3.new(C,0,X)
  113. end
  114. local m = V - C
  115. return Color3.new(color.r + m, color.g + m, color.b + m)
  116. end
  117.  
  118. function GetWeld(weld)
  119. if weld:findFirstChild("XAngle") == nil then
  120. local a = Instance.new("NumberValue", weld)
  121. a.Name = "XAngle"
  122. end
  123. if weld:findFirstChild("YAngle") == nil then
  124. local a = Instance.new("NumberValue", weld)
  125. a.Name = "YAngle"
  126. end
  127. if weld:findFirstChild("ZAngle") == nil then
  128. local a = Instance.new("NumberValue", weld)
  129. a.Name = "ZAngle"
  130. end
  131. return weld.C0.p, Vector3.new(weld.XAngle.Value, weld.YAngle.Value, weld.ZAngle.Value)
  132. end
  133.  
  134. function SetWeld(weld, i, loops, origpos,origangle, nextpos,nextangle)
  135. if weld:findFirstChild("XAngle") == nil then
  136. local a = Instance.new("NumberValue", weld)
  137. a.Name = "XAngle"
  138. end
  139. if weld:findFirstChild("YAngle") == nil then
  140. local a = Instance.new("NumberValue", weld)
  141. a.Name = "YAngle"
  142. end
  143. if weld:findFirstChild("ZAngle") == nil then
  144. local a = Instance.new("NumberValue", weld)
  145. a.Name = "ZAngle"
  146. end
  147.  
  148. local tox,toy,toz = 0,0,0
  149. if origangle.x > nextangle.x then
  150. tox = -math.abs(origangle.x - nextangle.x) /loops*i
  151. else
  152. tox = math.abs(origangle.x - nextangle.x) /loops*i
  153. end
  154. if origangle.y > nextangle.y then
  155. toy = -math.abs(origangle.y - nextangle.y) /loops*i
  156. else
  157. toy = math.abs(origangle.y - nextangle.y) /loops*i
  158. end
  159. if origangle.z > nextangle.z then
  160. toz = -math.abs(origangle.z - nextangle.z) /loops*i
  161. else
  162. toz = math.abs(origangle.z - nextangle.z) /loops*i
  163. end
  164.  
  165. local tox2,toy2,toz2 = 0,0,0
  166. if origpos.x > nextpos.x then
  167. tox2 = -math.abs(origpos.x - nextpos.x) /loops*i
  168. else
  169. tox2 = math.abs(origpos.x - nextpos.x) /loops*i
  170. end
  171. if origpos.y > nextpos.y then
  172. toy2 = -math.abs(origpos.y - nextpos.y) /loops*i
  173. else
  174. toy2 = math.abs(origpos.y - nextpos.y) /loops*i
  175. end
  176. if origpos.z > nextpos.z then
  177. toz2 = -math.abs(origpos.z - nextpos.z) /loops*i
  178. else
  179. toz2 = math.abs(origpos.z - nextpos.z) /loops*i
  180. end
  181.  
  182. weld.XAngle.Value = origangle.x + tox
  183. weld.YAngle.Value = origangle.y + toy
  184. weld.ZAngle.Value = origangle.z + toz
  185. weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz)
  186. end
  187.  
  188. function LoadTextures()
  189. local pls = game:service("ContentProvider")
  190. for i, v in pairs(loadids) do
  191. pls:Preload("http://www.roblox.com/asset/?id="..v)
  192. wait(0.04)
  193. end
  194. end
  195. LoadTextures()
  196.  
  197. function CreateGui()
  198. for i, v in pairs(player.PlayerGui:children()) do
  199. if v.className == "ScreenGui" and v.Name == "staminaGui" then
  200. v:remove()
  201. end
  202. end
  203. local g = Instance.new("ScreenGui", player.PlayerGui)
  204. g.Name = "staminaGui"
  205.  
  206. local c = Instance.new("Frame", g)
  207. c.Visible = false
  208. c.Size = UDim2.new(0,86,0,320)
  209. c.BackgroundTransparency = 1
  210. c.Position = UDim2.new(1,-96,0.5,-160)
  211. c.Name = "Container"
  212.  
  213. local t = Instance.new("TextLabel", c)
  214. t.Size = UDim2.new(0,0,-0.1,0)
  215. t.Position = UDim2.new(643,0,0.5,0)
  216. t.TextXAlignment = "Right"
  217. t.Font = "ArialBold"
  218. t.TextTransparency = 0.1
  219. t.TextColor3 = Color3.new(0,0.6,0.8)
  220. t.TextStrokeColor3 = Color3.new(0,0.2,0.8)
  221. t.TextStrokeTransparency = 0.3
  222. t.FontSize = 6
  223. t.BackgroundTransparency = 1
  224. local t2 = t:Clone()
  225. t2.Parent = c
  226. t2.Size = UDim2.new(0,0,0.1,0)
  227. local l = t:Clone()
  228. l.Parent = c
  229. l.Size = UDim2.new(0,0,0,0)
  230. l.Text = "-----"
  231.  
  232. local f1 = Instance.new("Frame", c)
  233. f1.Name = "Backing"
  234. f1.ClipsDescendants = true
  235. f1.Size = UDim2.new(1,0,0,0)
  236. f1.BackgroundColor3 = Color3.new(0.8,0,0)
  237. f1.BackgroundTransparency = 1
  238. local f1img = Instance.new("ImageLabel", f1)
  239. f1img.BackgroundTransparency = 1
  240. f1img.Image = "http://www.roblox.com/asset/?id=536 "
  241. f1img.Size = UDim2.new(1,0,0,c.Size.Y.Offset)
  242.  
  243. local f2 = Instance.new("Frame", c)
  244. f2.Name = "Overlay"
  245. f2.ClipsDescendants = true
  246. f2.Size = UDim2.new(1,0,1,0)
  247. f2.BackgroundColor3 = Color3.new(0,0,0.8)
  248. f2.BackgroundTransparency = 1
  249. local f2img = Instance.new("ImageLabel", f2)
  250. f2img.BackgroundTransparency = 1
  251. f2img.Image = "http://www.roblox.com/asset/?id=45"
  252. f2img.Size = UDim2.new(1,0,0,c.Size.Y.Offset)
  253.  
  254. function Calculate()
  255. local ysize = c.Size.Y.Offset
  256. local per = (stamina/maxstamina) * c.Size.Y.Offset
  257. local rem = (-(stamina/maxstamina-1)) * c.Size.Y.Offset
  258. f1.Size = UDim2.new(1,0,0,rem)
  259. f2.Size = UDim2.new(1,0,0,per)
  260. f2.Position = UDim2.new(0,0,0,rem)
  261. f2img.Position = UDim2.new(0,0,0,-rem)
  262. t.Text = math.floor(stamina)
  263. t2.Text = maxstamina
  264. end
  265. Calculate()
  266.  
  267. wait(0.01)
  268. c.Visible = true
  269. end
  270. CreateGui()
  271.  
  272. player.CharacterAdded:connect(function()
  273. char = player.Character
  274. Torsoz = char:findFirstChild("Torso")
  275. RA = char:findFirstChild("Right Arm")
  276. LA = char:findFirstChild("Left Arm")
  277. RL = char:findFirstChild("Right Leg")
  278. LL = char:findFirstChild("Left Leg")
  279. H = char:findFirstChild("Head")
  280. Hu = char:findFirstChild("Humanoid")
  281. RS = Torsoz:findFirstChild("Right Shoulder")
  282. LS = Torsoz:findFirstChild("Left Shoulder")
  283. RH = Torsoz:findFirstChild("Right Hip")
  284. LH = Torsoz:findFirstChild("Left Hip")
  285. N = Torsoz:findFirstChild("Neck")
  286. stamina = maxstamina
  287. CreateGui()
  288. end)
  289.  
  290. function RAY(pos, dir, startpos, endpos, distleft, collidedlist)
  291. collidedlist = collidedlist or {char}
  292. startpos = startpos or pos
  293. distleft = distleft or dir.unit * dir.magnitude
  294. endpos = endpos or pos + distleft
  295. local ray = Ray.new(pos, distleft)
  296. local hitz,enz = workspace:FindPartOnRayWithIgnoreList(ray, collidedlist)
  297. --[[
  298. local p = P:Clone()
  299. p.Parent = char
  300. p.Size = Vector3.new(0.4,0.4,0.4)
  301. p.BrickColor = BrickColor.new("Lime green")
  302. p.CanCollide = false
  303. p.CFrame = CFrame.new(enz)
  304. p.Transparency = 0.3
  305. ]]
  306. if hitz ~= nil then
  307. if hitz.CanCollide == false then
  308. table.insert(collidedlist, hitz)
  309. local newpos = enz
  310. local newdistleft = distleft - (dir.unit * (pos - newpos).magnitude)
  311. if newdistleft ~= NV then
  312. return RAY(newpos-(dir*0.01), dir, startpos, endpos, newdistleft+(dir*0.01), collidedlist)
  313. end
  314. end
  315. end
  316.  
  317. return hitz, enz, ray
  318. end
  319.  
  320. function Sit()
  321. Standing = false
  322. local hitz,enz = RAY(Torsoz.Position, Vector3.new(0,-4.1,0))
  323. local tordir = Vector3.new(Torsoz.CFrame.lookVector.x,0,Torsoz.CFrame.lookVector.z)
  324. if (hitz ~= nil and hitz.CanCollide == true) then
  325. local cf = CFrame.new(enz+Vector3.new(0,1.28,0), enz+Vector3.new(0,1.28,0)+tordir) * CFrame.Angles(math.pi/6,0,0)
  326. local hitz2,enz2 = RAY(enz+Vector3.new(0,2.25,0), tordir*-2.2)
  327. Hu.PlatformStand = true
  328. Torsoz.CFrame = cf
  329. local bp = Instance.new("BodyPosition", Torsoz)
  330. bp.Name = "StaminaBodyObject"
  331. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  332. bp.D = 100
  333. bp.position = cf.p
  334. local bg = Instance.new("BodyGyro", Torsoz)
  335. bg.Name = "StaminaBodyObject"
  336. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  337. bg.cframe = cf
  338. bg.D = 100
  339. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.34,-1,0.2), Vector3.new((math.pi/2)-(math.pi/6),0,math.pi/8))
  340. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.34,-1,0.2), Vector3.new((math.pi/2)-(math.pi/6),0,-math.pi/8))
  341.  
  342. if hitz2 ~= nil and hitz2.CanCollide == true then
  343. Joint3.C0 = CFrame.new(0.9,0.4,-0.45) * CFrame.Angles(0,math.pi/2.13,0) * CFrame.Angles(math.pi/2.3,0,0)
  344. Joint4.C0 = CFrame.new(-0.9,0.4,-0.4) * CFrame.Angles(0,-math.pi/2.05,0) * CFrame.Angles(math.pi/2.3,0,0)
  345. Joint5.C0 = CFrame.new(0,1,0) * CFrame.Angles(-math.pi/8.8,0,0)
  346. else
  347. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.4,0.4,0.1), Vector3.new(-(math.pi/6)-(math.pi/10),0,math.pi/9))
  348. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.4,0.4,0.1), Vector3.new(-(math.pi/6)-(math.pi/10),0,-math.pi/9))
  349. SetWeld(Joint5,1,1, NV,NV, Vector3.new(0,1,0), Vector3.new(-math.pi/12,0,0))
  350. end
  351.  
  352. Sitting = true
  353. Action = "Sitting"
  354. end
  355. end
  356.  
  357.  
  358. function Stand()
  359. Hu.PlatformStand = false
  360. if Sitting == true then
  361. local tordir = Torsoz.Position + (Torsoz.CFrame.lookVector*10000)
  362. local cf = CFrame.new(Torsoz.Position + Vector3.new(0,1.8,0), Vector3.new(tordir.x,Torsoz.Position.y,tordir.z))
  363. Torsoz.CFrame = cf
  364. end
  365. for i, v in pairs(Torsoz:children()) do
  366. if v.Name == "StaminaBodyObject" then
  367. v:remove()
  368. end
  369. end
  370. RH.Part0 = nil
  371. LH.Part0 = nil
  372. RS.Part0 = nil
  373. LS.Part0 = nil
  374. Joint1.Part0 = Torsoz
  375. Joint1.Part1 = RL
  376. Joint1.C0 = CFrame.new(0.5,-1,0)
  377. Joint1.C1 = CFrame.new(0,1,0)
  378. Joint2.Part0 = Torsoz
  379. Joint2.Part1 = LL
  380. Joint2.C0 = CFrame.new(-0.5,-1,0)
  381. Joint2.C1 = CFrame.new(0,1,0)
  382. Joint3.Part0 = Torsoz
  383. Joint3.Part1 = RA
  384. Joint3.C0 = CFrame.new(1.5,0.5,0)
  385. Joint3.C1 = CFrame.new(0,0.5,0)
  386. Joint4.Part0 = Torsoz
  387. Joint4.Part1 = LA
  388. Joint4.C0 = CFrame.new(-1.5,0.5,0)
  389. Joint4.C1 = CFrame.new(0,0.5,0)
  390. Joint5.Part0 = Torsoz
  391. Joint5.Part1 = H
  392. Joint5.C0 = CFrame.new(0,1,0)
  393. Joint5.C1 = CFrame.new(0,-0.5,0)
  394. Sitting = false
  395. Diving = false
  396. Standing = true
  397. Action = "Standing"
  398. end
  399.  
  400. --------------------------------------- Dive ----------------------------------
  401.  
  402. function Dive()
  403. stamina = stamina - 10
  404. flow.Value = flow.Value + 10
  405. if flow.Value > 100 then
  406. flow.Value = 100
  407. end
  408. Standing = false
  409. local dir = Vector3.new(Torsoz.CFrame.lookVector.x,0,Torsoz.CFrame.lookVector.z)
  410. GravPoint = -10
  411. DivingDir = dir
  412. local cf = CFrame.new(Torsoz.Position, dir+Vector3.new(0,Torsoz.Position.y,0))
  413. DivingCF = cf
  414. DivingDir = dir
  415. Hu.PlatformStand = true
  416. local bv = Instance.new("BodyVelocity", Torsoz)
  417. bv.Name = "StaminaBodyObject"
  418. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  419. bv.velocity = Vector3.new(DivingDir.x*24,GravPoint,DivingDir.z*24)
  420. DivingBV = bv
  421. local bg = Instance.new("BodyGyro", Torsoz)
  422. bg.Name = "StaminaBodyObject"
  423. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  424. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+bv.velocity) * CFrame.Angles(-math.pi/2,0,0)
  425. bg.D = 100
  426. DivingBG = bg
  427.  
  428. local joint = Joint3
  429. joint.C1 = CFrame.new(0,0.5,0)
  430. local joint2 = Joint4
  431. joint2.C1 = CFrame.new(0,0.5,0)
  432. local joint3 = Joint1
  433. joint3.C1 = CFrame.new(0,1,0)
  434. local joint4 = Joint2
  435. joint4.C1 = CFrame.new(0,1,0)
  436.  
  437. local joint5 = Joint5
  438.  
  439. Diving = true
  440. Action = "Diving"
  441.  
  442. for i = 1, 8 do
  443. SetWeld(joint,i,8, Vector3.new(1.5,0.5,0), NV, Vector3.new(1.45,0.5,0.1), Vector3.new(-0.2,-math.pi/9,math.pi/13))
  444. SetWeld(joint2,i,8, Vector3.new(-1.5,0.5,0), NV, Vector3.new(-1.45,0.5,0.1), Vector3.new(-0.2,math.pi/9,-math.pi/13))
  445. SetWeld(joint3,i,8, Vector3.new(0.5,-1,0), NV, Vector3.new(0.5,-1,0.03), Vector3.new(-0.2,-math.pi/10,math.pi/14))
  446. SetWeld(joint4,i,8, Vector3.new(-0.5,-1,0), NV, Vector3.new(-0.5,-1,0.03), Vector3.new(-0.2,math.pi/10,-math.pi/14))
  447. SetWeld(joint5,i,8, Vector3.new(0,1,0), NV, Vector3.new(0,1,0), Vector3.new(0.45,0,0))
  448. wait(0.025)
  449. end
  450.  
  451. local counter = 0
  452. while Diving == true do
  453. counter = counter + 1
  454. bg.Parent = Torsoz
  455. local hitz, enz = RAY(Torsoz.Position, bv.velocity.unit*4.6)
  456. if hitz ~= nil and hitz.CanCollide == true then
  457. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-4,0))
  458. if hitz2 ~= nil then
  459. Diving = "Rolling"
  460. Action = "DiveRolling"
  461. else
  462. Torsoz.CFrame = Torsoz.CFrame * CFrame.new(0,-0.3,0)
  463. Torsoz.Velocity = NV
  464. flow.Value = 0
  465. break
  466. end
  467. end
  468. if counter > 190 then
  469. break
  470. end
  471. wait(0.02)
  472. end
  473.  
  474. bv.velocity = (dir*20) + Vector3.new(0,-0.5,0)
  475.  
  476. local bgcf = bg.cframe
  477. local haslanded = false
  478. local count = 0
  479.  
  480. while haslanded == false do
  481. bg.cframe = bgcf * CFrame.Angles(-0.3*count,0,0)
  482. local hitz, enz = RAY(Torsoz.Position, ((Torsoz.CFrame*CFrame.new(0,-1,0)).p - Torsoz.CFrame.p).unit*1.6)
  483. if hitz ~= nil and hitz.CanCollide == true then
  484. haslanded = true
  485. end
  486. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-3.8,0))
  487. if hitz2 == nil then
  488. Torsoz.Velocity = NV
  489. break
  490. elseif haslanded == true then
  491. local bp = Instance.new("BodyPosition", Torsoz)
  492. bp.Name = "StaminaJumpFix"
  493. bp.maxForce = Vector3.new(0,1/0,0)
  494. bp.P = 7000
  495. bp.position = enz2 + Vector3.new(0,2.8,0)
  496. game:service("Debris"):AddItem(bp, 0.3)
  497. else
  498. bv.velocity = (dir*20) + Vector3.new(0,-(Torsoz.Position - enz2).magnitude*3,0)
  499.  
  500. end
  501. count = count + 1
  502. if count <= 6 then
  503. local i = count
  504. local j1,j1a = GetWeld(joint)
  505. local j2,j2a = GetWeld(joint2)
  506. local j3,j3a = GetWeld(joint3)
  507. local j4,j4a = GetWeld(joint4)
  508. local j5,j5a = GetWeld(joint5)
  509. SetWeld(joint,i,6, j1,j1a, Vector3.new(1.35,0.5,-0.2), Vector3.new(math.pi/2.6,0,-math.pi/5.8))
  510. SetWeld(joint2,i,6, j2,j2a, Vector3.new(-1.35,0.5,-0.2), Vector3.new(math.pi/2.6,0,math.pi/5.8))
  511. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.51,0.4,-0.6), Vector3.new(-0.1,0,0.05))
  512. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.51,0.4,-0.6), Vector3.new(-0.1,0,-0.05))
  513. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,1,0), Vector3.new(-0.4,0,0))
  514. elseif count >= 50 then
  515. break
  516. end
  517. wait(0.02)
  518. end
  519.  
  520. Torsoz.Velocity = NV
  521.  
  522. Stand()
  523. DivingCooldown = 9
  524. end
  525.  
  526. function FindSurface(part, position)
  527. local obj = part.CFrame:pointToObjectSpace(position)
  528. local siz = part.Size/2
  529. for i,v in pairs(Enum.NormalId:GetEnumItems()) do
  530. local vec = Vector3.FromNormalId(v)
  531. local wvec = part.CFrame:vectorToWorldSpace(vec)
  532. local vz = (obj)/(siz*vec)
  533. if (math.abs(vz.X-1) < 0.01 or math.abs(vz.Y-1) < 0.01 or math.abs(vz.Z-1) < 0.01) then
  534. return wvec,vec
  535. end
  536. end
  537. if part.className == "WedgePart" then
  538. return part.CFrame:vectorToWorldSpace(Vector3.new(0,0.707,-0.707)), Vector3.new(0,0.707,-0.707)
  539. end
  540. end
  541.  
  542. function HWallRun(part, pos, side)
  543. if (part.className == "Part" and part.Shape == Enum.PartType.Block) or part.className ~= "Part" then
  544. flow.Value = flow.Value + 9
  545. Standing = false
  546. HWallRunning = true
  547. Action = "HWallRunning"
  548. GravPoint = 10
  549. HWRLastPart = part
  550. local dir, dirc = FindSurface(part, pos)
  551. towall = -dir
  552. dir = (CFrame.new(NV, dir) * CFrame.Angles(0,side,0)).lookVector
  553.  
  554. local bv = Instance.new("BodyVelocity", Torsoz)
  555. bv.Name = "StaminaBodyObject"
  556. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  557. bv.P = 9000
  558. bv.velocity = (dir*(sprint-0.5)) + Vector3.new(0,GravPoint,0)
  559. local bg = Instance.new("BodyGyro", Torsoz)
  560. bg.Name = "StaminaBodyObject"
  561. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  562. bg.cframe = CFrame.new(Torsoz.Position+(towall*-2), Torsoz.Position) * CFrame.Angles(0,-side,-side/4.2)
  563. bg.D = 100
  564.  
  565. local sid = Instance.new("Snap")
  566.  
  567. local joint1 = Joint3
  568. if side == -math.pi/2 then
  569. SetWeld(joint1,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(math.pi/1.3,0.1,math.pi/2.5))
  570. else
  571. sid = joint1
  572. SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.6,0), Vector3.new(-math.pi/12,0,math.pi/7))
  573. end
  574. local j1c0 = joint1.C0
  575.  
  576. local joint2 = Joint4
  577. if side == math.pi/2 then
  578. SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(math.pi/1.3,-0.1,-math.pi/2.5))
  579. else
  580. sid = joint2
  581. SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.6,0), Vector3.new(-math.pi/12,0,-math.pi/7))
  582. end
  583. local j2c0 = joint2.C0
  584.  
  585. local joint3 = Joint1
  586. joint3.C1 = CFrame.new(0,1,0)
  587. if side == -math.pi/2 then
  588. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.5,-0.38,-0.3), Vector3.new(0,math.pi/2,0.14))
  589. else
  590. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.5,-0.8,-0.2), Vector3.new(0,math.pi/2,0.2))
  591. end
  592.  
  593. local joint4 = Joint2
  594. joint4.C1 = CFrame.new(0,1,0)
  595. if side == -math.pi/2 then
  596. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.5,-0.8,-0.2), Vector3.new(0,0,0.2))
  597. else
  598. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.5,-0.38,-0.3), Vector3.new(0,0,0.14))
  599. end
  600.  
  601. local joint5 = Joint5
  602. SetWeld(joint5,1,1,NV,NV,Vector3.new(0,0.9,0),Vector3.new(0,0,side/7))
  603.  
  604. Torsoz.CFrame = CFrame.new(pos+(towall*-2), pos) * CFrame.Angles(0,-side,-side/2.2)
  605. bg.cframe = CFrame.new(pos+(towall*-2), pos) * CFrame.Angles(0,-side,-side/2.2)
  606.  
  607. local aniangle = 0
  608. local aniplus = true
  609. local aniangle2 = 0
  610. local aniplus2 = true
  611.  
  612. local prevpart = part
  613. HWRLastPart = part
  614. while HWallRunning == true do
  615.  
  616. if aniangle > math.pi then
  617. aniplus = false
  618. elseif aniangle < -math.pi then
  619. aniplus = true
  620. end
  621. if aniplus == true then
  622. aniangle = aniangle + 0.95
  623. elseif aniplus == false then
  624. aniangle = aniangle - 0.95
  625. end
  626.  
  627. if aniangle2 > math.pi then
  628. aniplus2 = false
  629. elseif aniangle2 < -math.pi then
  630. aniplus2 = true
  631. end
  632. if aniplus2 == true then
  633. aniangle2 = aniangle2 + 0.23
  634. elseif aniplus2 == false then
  635. aniangle2 = aniangle2 - 0.23
  636. end
  637.  
  638. Hu.PlatformStand = true
  639. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-3,0))
  640. local hitz2, enz2 = RAY(Torsoz.Position, towall*3.4)
  641.  
  642. --- if player ends wall run on ground
  643. if hitz ~= nil and hitz.CanCollide == true then
  644. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,0)
  645. local offset = (bg.cframe.p.y+enz2.y) - bg.cframe.p.y
  646. Torsoz.CFrame = CFrame.new(Vector3.new(bg.cframe.p.x,offset,bg.cframe.p.z), enz2) * CFrame.Angles(0,-side,0)
  647. Torsoz.Velocity = NV
  648. break
  649. end
  650.  
  651. ---- if new wall found --------
  652. if hitz2 ~= nil and hitz2.CanCollide == true then
  653. if hitz2 ~= prevpart then
  654. local direct = CFrame.new(Torsoz.Position, Torsoz.Position+dir) * CFrame.Angles(0,side,0)
  655. local hitz3, enz3 = RAY(Torsoz.Position, (direct * CFrame.Angles(0,-side/2.3,0)).lookVector*4)
  656. if hitz3 ~= nil then
  657. Torsoz.CFrame = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side*1.1,-side/2.2)
  658. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side*1.1,-side/2.2)
  659. dir, dirc = FindSurface(hitz2, enz2)
  660. towall = -dir
  661. dir = (CFrame.new(NV, dir) * CFrame.Angles(0,side,0)).lookVector
  662. prevpart = hitz2
  663. HWRLastPart = hitz2
  664. else
  665. ---- if player fails to find new wall to run on
  666. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  667. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  668. Torsoz.Velocity = NV
  669. HWRCooldown = 8
  670. break
  671. end
  672. end
  673. --- continue to wall run
  674. Torsoz.CFrame = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,-side/2.2)
  675. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,-side/2.2)
  676. else
  677. ---- if player ends wall run at end of wall
  678. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  679. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  680. Torsoz.Velocity = NV
  681. HWRCooldown = 8
  682. break
  683. end
  684.  
  685. local hitz3, enz3 = RAY(Torsoz.Position, Torsoz.CFrame.lookVector*2)
  686. if hitz3 ~= nil and hitz3.CanCollide == true then
  687. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  688. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  689. Torsoz.Velocity = NV
  690. HWRCooldown = 8
  691. break
  692. end
  693.  
  694. bv.Parent = Torsoz
  695. bv.velocity = (dir*(sprint-0.5)) + Vector3.new(0,GravPoint,0)
  696. bg.cframe = bg.cframe * CFrame.Angles(aniangle/80,aniangle/80,0)
  697. Torsoz.CFrame = Torsoz.CFrame * CFrame.Angles(aniangle/80,aniangle/80,0)
  698. local j3,j3a = GetWeld(joint3)
  699. local j4,j4a = GetWeld(joint4)
  700. SetWeld(joint3,1,1, j3,j3a, j3,Vector3.new(-0.2+(aniangle/4),0,0))
  701. SetWeld(joint4,1,1, j4,j4a, j4,Vector3.new(-0.2+(-aniangle/4),0,0))
  702. if side == math.pi/2 then
  703. local j1,j1a = GetWeld(joint1)
  704. SetWeld(joint1,1,1, j1,j1a, j1, Vector3.new(0,0,0.8+(aniangle2/14)))
  705. else
  706. local j2,j2a = GetWeld(joint2)
  707. SetWeld(joint2,1,1, j2,j2a, j2, Vector3.new(0,0,-0.8-(aniangle2/14)))
  708. end
  709.  
  710. wait(0.025)
  711. if GravPoint < -100 then
  712. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,0)
  713. local offset = math.abs((bg.cframe.p.y+enz2.y) - bg.cframe.p.y)
  714. Torsoz.CFrame = CFrame.new(Vector3.new(bg.cframe.p.x,offset,bg.cframe.p.z), enz2) * CFrame.Angles(0,-side,0)
  715. break
  716. end
  717.  
  718. end
  719.  
  720. if HWallRunning == "Jumping" then
  721. HWRCooldown = 6
  722. joint1.C1 = CFrame.new(0,0.5,0)
  723.  
  724. joint2.C1 = CFrame.new(0,0.5,0)
  725. if side == -math.pi/2 then
  726. joint2.C0 = CFrame.new(-1.35,0.5,0) * CFrame.Angles(0,side/2.4,-math.pi/3)
  727. else
  728. joint2.C0 = CFrame.new(-1.35,0.5,0) * CFrame.Angles(0,side/2.4,-math.pi/4)
  729. end
  730.  
  731. joint3.C1 = CFrame.new(0,1,0)
  732. if side == -math.pi/2 then
  733. joint3.C0 = CFrame.new(0.5,-0.8,0) * CFrame.Angles(0,math.pi+(side/2.4),-math.pi/4)
  734. else
  735. joint3.C0 = CFrame.new(0.5,-0.8,0) * CFrame.Angles(0,(side/2.4),math.pi/4)
  736. end
  737. joint4.C1 = CFrame.new(0,1,0)
  738. if side == -math.pi/2 then
  739. joint4.C0 = CFrame.new(-0.5,-0.8,0) * CFrame.Angles(0,math.pi+(side/2.4),math.pi/4)
  740. else
  741. joint4.C0 = CFrame.new(-0.5,-0.8,0) * CFrame.Angles(0,(side/2.4),-math.pi/4)
  742. end
  743.  
  744. local joint5 = Joint5
  745. joint5.C1 = CFrame.new(0,-0.5,0) * CFrame.Angles(0,side/2.4,0)
  746. joint5.C0 = CFrame.new(0,1,0)
  747.  
  748. local j1,j1a = GetWeld(joint1)
  749. local j2,j2a = GetWeld(joint2)
  750. local j3,j3a = GetWeld(joint3)
  751. local j4,j4a = GetWeld(joint4)
  752. local j5,j5a = GetWeld(joint5)
  753.  
  754. GravPoint = 26
  755. local collidecount = 0
  756. local bgangle = side/2
  757. local count = 1
  758. local dir2 = (CFrame.new(NV, dir) * CFrame.Angles(0,-side/2.4,0)).lookVector
  759. HWRDir = dir2
  760. bv.velocity = (dir2*(sprint+5)) + Vector3.new(0,GravPoint,0)
  761. while HWallRunning == "Jumping" do
  762. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-4,0))
  763. local hitz2, enz2 = RAY(Torsoz.Position, dir2*1.4)
  764. if hitz ~= nil and hitz.CanCollide == true then
  765. local offset = math.abs(enz.y - Torsoz.CFrame.p.y)
  766. Torsoz.CFrame = CFrame.new(enz+Vector3.new(0,2.9,0), enz+Vector3.new(0,2.9,0)+dir2)
  767. Torsoz.Velocity = NV
  768. break
  769. end
  770.  
  771. if hitz2 ~= nil and hitz2.CanCollide == true then
  772. collidecount = collidecount + 1
  773. if collidecount == 4 then
  774. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir2) * CFrame.new(0,0,0.4)
  775. Torsoz.Velocity = Vector3.new(0,Torsoz.Velocity.y,0)
  776. HWRCooldown = 5
  777. VWRCooldown = 5
  778. wait(0.02)
  779. break
  780. end
  781. end
  782.  
  783. if side/2 > 0 then
  784. if bgangle > 0.2 then
  785. bgangle = bgangle - 0.055
  786. end
  787. else
  788. if bgangle < -0.2 then
  789. bgangle = bgangle + 0.055
  790. end
  791. end
  792.  
  793. if count <= 5 then
  794. if side == -math.pi/2 then
  795. SetWeld(joint1,count,5, j1,j1a, Vector3.new(1.35,0.5,0), Vector3.new(0,side/2.4,math.pi/4))
  796. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-1.35,0.5,0), Vector3.new(0,side/2.4,-math.pi/3))
  797. SetWeld(joint3,count,5, j3,j3a, Vector3.new(0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  798. joint3.C0 = joint3.C0 * CFrame.Angles((-math.pi/4)/5*count,0,0)
  799. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  800. joint4.C0 = joint4.C0 * CFrame.Angles((math.pi/4)/5*count,0,0)
  801. else
  802. SetWeld(joint1,count,5, j1,j1a, Vector3.new(1.35,0.5,0), Vector3.new(0,side/2.4,math.pi/3))
  803. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-1.35,0.5,0), Vector3.new(0,side/2.4,-math.pi/4))
  804. SetWeld(joint3,count,5, j3,j3a, Vector3.new(0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  805. joint3.C0 = joint3.C0 * CFrame.Angles((math.pi/4)/5*count,0,0)
  806. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  807. joint4.C0 = joint4.C0 * CFrame.Angles((-math.pi/4)/5*count,0,0)
  808. end
  809.  
  810. count = count + 1
  811. end
  812.  
  813. bg.Parent = Torsoz
  814. bg.cframe = CFrame.new(NV, dir) * CFrame.Angles(0,side/15,-bgangle)
  815. bv.velocity = (dir2*(sprint+5)) + Vector3.new(0,GravPoint,0)
  816. if collidecount ~= 0 then
  817. bv.velocity = Vector3.new(0,bv.velocity.y,0)
  818. end
  819. if GravPoint < -120 then
  820. break
  821. end
  822. wait(0.025)
  823. end
  824. end
  825.  
  826. Hu.PlatformStand = false
  827. bv:remove()
  828.  
  829. HWRGravDrop = false
  830. Stand()
  831. HWallRunning = false
  832. end
  833. end
  834.  
  835. function VWR(part, pos)
  836. if (part.className == "Part" and part.Shape == Enum.PartType.Block) or part.className ~= "Part" then
  837. print("VWR Activated")
  838. flow.Value = flow.Value + 9
  839. Standing = false
  840. VWallRunning = true
  841. Action = "VWallRunning"
  842. GravPoint = 0
  843. local percent = 1
  844. VWRLastPart = part
  845. local dir, dirc = FindSurface(part, pos)
  846. towall = -dir
  847. dir = (CFrame.new(NV, -dir) * CFrame.Angles(math.pi/2,0,0)).lookVector
  848. --[[
  849. local p = P:Clone()
  850. p.Parent = char
  851. p.Size = Vector3.new(2,2,2)
  852. p.BrickColor = BrickColor.new("Lime green")
  853. p.CanCollide = false
  854. p.CFrame = part.CFrame * CFrame.new(dirc*5)
  855. p.Transparency = 0.3
  856. ]]
  857. local bv = Instance.new("BodyVelocity", Torsoz)
  858. bv.Name = "StaminaBodyObject"
  859. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  860. bv.P = 9000
  861. bv.velocity = (dir*(sprint-1))*percent
  862.  
  863. local bg = Instance.new("BodyGyro", Torsoz)
  864. bg.Name = "StaminaBodyObject"
  865. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  866. bg.D = 100
  867. local posi = pos + (-towall*1.8)
  868. bg.cframe = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0)
  869. Torsoz.CFrame = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0)
  870.  
  871. local joint1 = Joint3
  872. SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,0,math.pi/8))
  873.  
  874. local joint2 = Joint4
  875. SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,0,-math.pi/8))
  876.  
  877. local joint3 = Joint1
  878. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.48,-0.6,-0.1), Vector3.new(0,math.pi/2,0))
  879. joint3.C1 = CFrame.new(0,0.7,0.2) * CFrame.Angles(0,math.pi/2,0)
  880.  
  881. local joint4 = Joint2
  882. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.48,-0.6,-0.1), Vector3.new(0,math.pi/2,0))
  883. joint4.C1 = CFrame.new(0,0.7,0.2) * CFrame.Angles(0,math.pi/2,0)
  884.  
  885. local joint5 = Joint5
  886. SetWeld(joint5,1,1, NV,NV, Vector3.new(0,1,0), Vector3.new(math.pi/20,0,0))
  887.  
  888. local aniangle = 0
  889. local aniplus = true
  890.  
  891. while VWallRunning == true do
  892. local hitz, enz = RAY(Torsoz.Position, towall*2.1)
  893. local hitz2, enz2 = RAY(Torsoz.Position, (CFrame.new(NV,towall)*CFrame.Angles(math.pi/2,0,0)).lookVector*2.4)
  894.  
  895. if aniangle > math.pi then
  896. aniplus = false
  897. elseif aniangle < -math.pi then
  898. aniplus = true
  899. end
  900. if aniplus == true then
  901. aniangle = aniangle + (1.3*(percent+0.2))
  902. elseif aniplus == false then
  903. aniangle = aniangle - (1.3*(percent+0.2))
  904. end
  905.  
  906. bv.velocity = (dir*(sprint-1))*percent
  907. if VWRLeft == true then
  908. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * (11*percent+5))
  909. end
  910. if VWRRight == true then
  911. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * (11*percent+5))
  912. end
  913.  
  914. bg.cframe = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0) * CFrame.Angles(0,aniangle/60,0)
  915.  
  916. SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,aniangle/52,(math.pi/8)+(aniangle/30)))
  917. SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,aniangle/52,(-math.pi/8)+(-aniangle/30)))
  918. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.51,-0.75,-(aniangle/30)), Vector3.new(0,math.pi/2,(aniangle/8)-0.3))
  919. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.51,-0.75,(aniangle/30)), Vector3.new(0,math.pi/2,(-aniangle/8)-0.3))
  920.  
  921. if hitz == nil then
  922. local lv = Torsoz.Position + (Torsoz.CFrame.lookVector*100)
  923. Torsoz.CFrame = CFrame.new(Torsoz.Position, Vector3.new(lv.x,Torsoz.Position.y,lv.z))
  924. break
  925. end
  926.  
  927. if hitz2 ~= nil then
  928. percent = 0
  929. VWallRunning = "Falling"
  930. Action = "VWRFalling"
  931. GravPoint = -7
  932. break
  933. end
  934.  
  935. wait(0.02)
  936. percent = percent - 0.028
  937. if percent <= 0.15 then
  938. VWallRunning = "Falling"
  939. Action = "VWRFalling"
  940. end
  941. end
  942.  
  943. -------------------------- Falling from VWR ------------------------------
  944. if VWallRunning == "Falling" then
  945. GravPoint = GravPoint - 1
  946. local dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  947. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  948.  
  949. local j1,j1a = GetWeld(joint1)
  950. local j2,j2a = GetWeld(joint2)
  951. local j3,j3a = GetWeld(joint3)
  952. local j4,j4a = GetWeld(joint4)
  953. local j5,j5a = GetWeld(joint5)
  954.  
  955. local counter = 0
  956. while VWallRunning == "Falling" do
  957. counter = counter + 1
  958. local hitz, enz = RAY(H.Position, Vector3.new(0,-2.4,0))
  959.  
  960. dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  961. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  962. if VWRLeft == true then
  963. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  964. end
  965. if VWRRight == true then
  966. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  967. end
  968. bg.cframe = CFrame.new(NV, (-towall*30) + Vector3.new(0,GravPoint,0)) * CFrame.Angles(-math.pi/2.55,math.pi,0)
  969.  
  970. if counter <= 35 then
  971. SetWeld(joint1,counter,35, j1,j1a, Vector3.new(1.4,0.45,-0.1), Vector3.new(math.pi/9,0,math.pi/9))
  972. SetWeld(joint2,counter,35, j2,j2a, Vector3.new(-1.4,0.45,-0.1), Vector3.new(math.pi/9,0,-math.pi/9))
  973. SetWeld(joint3,counter,35, j3,j3a, Vector3.new(0.5,-0.75,0), Vector3.new(0,math.pi/2,math.pi/9))
  974. joint3.C1 = CFrame.new(0,0.7 + (0.3/35*counter),0.2 - (0.2/35*counter)) * CFrame.Angles(0,math.pi/2,0)
  975. SetWeld(joint4,counter,35, j4,j4a, Vector3.new(-0.5,-0.75,0), Vector3.new(0,math.pi/2,math.pi/9))
  976. joint4.C1 = CFrame.new(0,0.7 + (0.3/35*counter),0.2 - (0.2/35*counter)) * CFrame.Angles(0,math.pi/2,0)
  977. SetWeld(joint5,counter,35, j5,j5a, Vector3.new(0,1,0), Vector3.new(-math.pi/6,0,0))
  978. end
  979.  
  980. if hitz ~= nil then
  981. bv:remove()
  982. Torsoz.CFrame = CFrame.new(enz+Vector3.new(0,2,0), (enz+Vector3.new(0,2,0)) + ((-towall*25) + Vector3.new(0,GravPoint,0))) * CFrame.Angles(-math.pi/2.55,math.pi,0)
  983. Torsoz.Velocity = NV
  984. Torsoz.RotVelocity = NV
  985. local bp = Instance.new("BodyPosition", Torsoz)
  986. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  987. bp.position = Torsoz.CFrame.p
  988. game:service("Debris"):AddItem(bp, 0.16)
  989. flow.Value = 0
  990. break
  991. end
  992.  
  993. if GravPoint > - 600 then
  994. GravPoint = GravPoint - 1.9
  995. end
  996. if counter > 200 then
  997. break
  998. end
  999. wait(0.02)
  1000. end
  1001.  
  1002. local bp = Instance.new("BodyPosition")
  1003.  
  1004. local counter2 = counter
  1005. local bgangleplus = 0
  1006.  
  1007. local j1,j1a = GetWeld(joint1)
  1008. local j2,j2a = GetWeld(joint2)
  1009. local j3,j3a = GetWeld(joint3)
  1010. local j4,j4a = GetWeld(joint4)
  1011. local j5,j5a = GetWeld(joint5)
  1012.  
  1013. local landingpos
  1014.  
  1015. while VWallRunning == "BackflipFromFall" do
  1016. counter2 = counter2 + 1
  1017. local hitz, enz = RAY(H.Position+Vector3.new(0,2,0), Vector3.new(0,-4.4,0))
  1018.  
  1019. if counter2 - counter < 13 then
  1020. bgangleplus = bgangleplus - ((math.pi*1.1)/13)
  1021. end
  1022. if counter2 - counter <= 13 then
  1023. SetWeld(joint1,counter2-counter,13, j1,j1a, Vector3.new(1.4,0.5,0.1), Vector3.new(math.pi/2,0.1,math.pi/2))
  1024. SetWeld(joint2,counter2-counter,13, j2,j2a, Vector3.new(-1.4,0.5,0.1), Vector3.new(math.pi/2,-0.1,-math.pi/2))
  1025. SetWeld(joint3,counter2-counter,13, j3,j3a, Vector3.new(0.52,-0.3,-0.65), Vector3.new(0,math.pi/2,0))
  1026. SetWeld(joint4,counter2-counter,13, j4,j4a, Vector3.new(-0.51,-0.9,-0.05), Vector3.new(0,math.pi/2,0))
  1027. SetWeld(joint5,counter2-counter,13, j5,j5a, Vector3.new(0,0.9,0), Vector3.new(-math.pi/7,0,0))
  1028. end
  1029.  
  1030. dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  1031. --bv.velocity = Vector3.new(0,-2,0)
  1032. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  1033. if VWRLeft == true then
  1034. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  1035. end
  1036. if VWRRight == true then
  1037. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  1038. end
  1039. bg.cframe = CFrame.new(NV, (-towall*30) + Vector3.new(0,GravPoint,0)) * CFrame.Angles((-math.pi/2.4) + bgangleplus,math.pi,0)
  1040.  
  1041. if hitz ~= nil then
  1042. bv:remove()
  1043. landingpos = enz - (towall*1.3)
  1044. if counter2 - counter > 8 then
  1045. bp = Instance.new("BodyPosition", Torsoz)
  1046. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  1047. bp.position = enz+Vector3.new(0,2.4,0) + (-towall*1)
  1048. VWallRunning = "LandingFall"
  1049. else
  1050. Torsoz.CFrame = bg.cframe + (enz+Vector3.new(0,2.3,0))
  1051. Torsoz.Velocity = NV
  1052. Torsoz.RotVelocity = NV
  1053. local bp = Instance.new("BodyPosition", Torsoz)
  1054. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  1055. bp.position = Torsoz.CFrame.p
  1056. game:service("Debris"):AddItem(bp, 0.14)
  1057. flow.Value = 0
  1058. end
  1059. break
  1060. end
  1061.  
  1062. if GravPoint > - 180 then
  1063. GravPoint = GravPoint - 1.9
  1064. end
  1065. if counter2 > 200 then
  1066. break
  1067. end
  1068. wait(0.02)
  1069. end
  1070.  
  1071. if VWallRunning == "LandingFall" then
  1072. print("Landing")
  1073.  
  1074. joint3.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  1075. joint4.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  1076. local j1,j1a = GetWeld(joint1)
  1077. local j2,j2a = GetWeld(joint2)
  1078. local j3,j3a = GetWeld(joint3)
  1079. local j4,j4a = GetWeld(joint4)
  1080. local j5,j5a = GetWeld(joint5)
  1081.  
  1082. local a
  1083. local mesh
  1084. if GravPoint < -100 then
  1085. gp = GravPoint
  1086. a = P:Clone()
  1087. a.Parent = Torsoz
  1088. a.Name = "AirLandingEffect"
  1089. a.BrickColor = BrickColor.new("Medium stone grey")
  1090. a.Transparency = 0.3
  1091. a.CFrame = CFrame.new(landingpos+Vector3.new(0,2,0))
  1092. mesh = Instance.new("SpecialMesh", a)
  1093. mesh.MeshId = "http://www.roblox.com/asset/?id=1323306"
  1094. mesh.Scale = Vector3.new(0,0,0)
  1095. end
  1096.  
  1097. local bgcf = CFrame.new(NV, Vector3.new(towall.x,0,towall.z))
  1098. bg.cframe = bgcf * CFrame.Angles(-math.pi/7,0,0)
  1099. local bgval = math.pi/7/2
  1100.  
  1101. for i = 1, 6 do
  1102. Hu.PlatformStand = true
  1103. SetWeld(joint1,i,6, j1,j1a, Vector3.new(1.2,0.5,0.2), Vector3.new(math.pi/2,0.5,math.pi/1.2))
  1104. SetWeld(joint2,i,6, j2,j2a, Vector3.new(-1.2,0.5,0.2), Vector3.new(math.pi/2,-0.5,-math.pi/1.2))
  1105. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.51,-0.3,-0.8), Vector3.new(0,math.pi/2,-math.pi/7))
  1106. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.51,-0.8,-0.7), Vector3.new(0,math.pi/2,-math.pi/3))
  1107. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,0.85,0), Vector3.new(-math.pi/8,0,0))
  1108. bp.position = bp.position + Vector3.new(0,-0.07,0)
  1109. bg.cframe = bgcf * CFrame.Angles((-bgval*2) + (bgval/6*i),0,0)
  1110. Torsoz.CFrame = bg.cframe + bp.position
  1111. if a ~= nil then
  1112. mesh.Scale = mesh.Scale + Vector3.new(-gp/100,-gp/100,-gp/100)
  1113. a.Transparency = 0.3 + (0.7/6*i)
  1114. end
  1115. wait(0.02)
  1116. end
  1117. if a ~= nil then
  1118. a:remove()
  1119. end
  1120. local j1,j1a = GetWeld(joint1)
  1121. local j2,j2a = GetWeld(joint2)
  1122. local j3,j3a = GetWeld(joint3)
  1123. local j4,j4a = GetWeld(joint4)
  1124. local j5,j5a = GetWeld(joint5)
  1125. for i = 1, 6 do
  1126. Hu.PlatformStand = true
  1127. SetWeld(joint1,i,6, j1,j1a, Vector3.new(1.5,0.5,0), Vector3.new(0,0,0))
  1128. SetWeld(joint2,i,6, j2,j2a, Vector3.new(-1.5,0.5,0), Vector3.new(0,0,0))
  1129. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.5,-1,0), Vector3.new(0,math.pi/2,0))
  1130. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.5,-1,0), Vector3.new(0,math.pi/2,0))
  1131. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,1,0), Vector3.new(0,0,0))
  1132. bp.position = bp.position + Vector3.new(0,0.1,0)
  1133. bg.cframe = bgcf * CFrame.Angles(-bgval + (bgval/6*i),0,0)
  1134. Torsoz.CFrame = bg.cframe + bp.position
  1135. wait(0.02)
  1136. end
  1137.  
  1138. bp:remove()
  1139. end
  1140.  
  1141. end
  1142.  
  1143. bv:remove()
  1144. bg:remove()
  1145. VWallRunning = false
  1146. Stand()
  1147. end
  1148. end
  1149.  
  1150. function Slide(pos)
  1151. flow.Value = flow.Value + 6
  1152. Action = "Sliding"
  1153. Sliding = true
  1154. GravPoint = Torsoz.Velocity.y
  1155. local spd = Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude + 10
  1156. local dir = Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).unit
  1157.  
  1158. local bv = Instance.new("BodyVelocity", Torsoz)
  1159. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  1160. bv.velocity = dir*spd
  1161. local bg = Instance.new("BodyGyro", Torsoz)
  1162. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  1163. bg.cframe = CFrame.new(NV, dir) * CFrame.Angles(math.pi/2.2,0.24,0)
  1164.  
  1165. local joint1 = Joint1
  1166. local joint2 = Joint2
  1167. local joint3 = Joint3
  1168. local joint4 = Joint4
  1169. local joint5 = Joint5
  1170. local j1,j1a = GetWeld(joint1)
  1171. local j2,j2a = GetWeld(joint2)
  1172.  
  1173. SetWeld(joint1,1,1, NV,NV, Vector3.new(j1.x,j1.y,j1.z), Vector3.new(j1a.x,math.pi/2,j1a.z))
  1174. joint1.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  1175. SetWeld(joint2,1,1, NV,NV, Vector3.new(j2.x,j2.y,j2.z), Vector3.new(j2a.x,math.pi/2,j2a.z))
  1176. joint2.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  1177.  
  1178. local j1,j1a = GetWeld(joint1)
  1179. local j2,j2a = GetWeld(joint2)
  1180. local j3,j3a = GetWeld(joint3)
  1181. local j4,j4a = GetWeld(joint4)
  1182. local j5,j5a = GetWeld(joint5)
  1183.  
  1184. local count = 0
  1185. local lastpos
  1186.  
  1187. while Sliding == true do
  1188. count = count + 1
  1189. Hu.PlatformStand = true
  1190. local hitz1, enz1 = RAY(Torsoz.Position+Vector3.new(0,0.03,0), dir *2.5)
  1191. local hitz2, enz2 = RAY(Torsoz.Position-Vector3.new(0,0.2,0), dir *2.5)
  1192. local ghitz, genz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  1193. bv.velocity = dir*spd + Vector3.new(0,GravPoint,0)
  1194.  
  1195. if count <= 5 then
  1196. SetWeld(joint1,count,5, j1,j1a, Vector3.new(0.5,-0.8,-0.15), Vector3.new(0,(math.pi/2)+0.1,-0.4))
  1197. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-0.5,-1,0), Vector3.new(0,(math.pi/2)-0.4,0))
  1198. SetWeld(joint3,count,5, j3,j3a, Vector3.new(1.5,0.5,0), Vector3.new(-0.7,-0.24,math.pi/5))
  1199. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-1.5,0.5,0), Vector3.new(-0.1,0,-math.pi/1.5))
  1200. SetWeld(joint5,count,5, j5,j5a, Vector3.new(0,1,0), Vector3.new(-0.5,-0.2,0))
  1201. end
  1202.  
  1203. if (hitz1 ~= nil and hitz1.CanCollide == true) or (hitz2 ~= nil and hitz2.CanCollide == true) then
  1204. bv:remove()
  1205. bg:remove()
  1206. Sliding = "HitObject"
  1207. end
  1208. if ghitz ~= nil then
  1209. GravPoint = 18
  1210. Torsoz.CFrame = CFrame.new(genz, genz+dir) * CFrame.Angles(math.pi/2.2,0.24,0) + Vector3.new(0,0.7,0)
  1211. spd = spd - 0.95
  1212. else
  1213. if GravPoint > -180 then
  1214. GravPoint = GravPoint - 5.6
  1215. end
  1216. spd = spd - 0.36
  1217. end
  1218. if spd < 7 then
  1219. Sliding = false
  1220. end
  1221. wait(0.02)
  1222. end
  1223.  
  1224. if Sliding == false then
  1225. local j1,j1a = GetWeld(joint1)
  1226. local j2,j2a = GetWeld(joint2)
  1227. local j3,j3a = GetWeld(joint3)
  1228. local j4,j4a = GetWeld(joint4)
  1229. local j5,j5a = GetWeld(joint5)
  1230. for i = 1, 4 do
  1231. SetWeld(joint1,i,4, j1,j1a, Vector3.new(0.5,-1,0), Vector3.new(0,math.pi/2,0))
  1232. SetWeld(joint2,i,4, j2,j2a, Vector3.new(-0.5,-1,0), Vector3.new(0,math.pi/2,0))
  1233. SetWeld(joint3,i,4, j3,j3a, Vector3.new(1.5,0.5,0), NV)
  1234. SetWeld(joint4,i,4, j4,j4a, Vector3.new(-1.5,0.5,0), NV)
  1235. SetWeld(joint5,i,4, j5,j5a, Vector3.new(0,1,0), NV)
  1236. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  1237. bg.cframe = CFrame.new(NV, dir) * CFrame.Angles((math.pi/2.2) - ((math.pi/2.2)/4*i),0.24 - (0.24/4*i),0)
  1238. bv.velocity = dir*spd + Vector3.new(0,GravPoint,0)
  1239.  
  1240. if hitz ~= nil then
  1241. GravPoint = 0
  1242. Torsoz.CFrame = CFrame.new(enz, enz+dir) * CFrame.Angles((math.pi/2.2) - ((math.pi/2.2)/4*i),0.24 - (0.24/4*i),0) + Vector3.new(0,0.7+(1.8/4*i),0)
  1243. spd = spd - 0.95
  1244. else
  1245. if GravPoint > -180 then
  1246. GravPoint = GravPoint - 5.6
  1247. end
  1248. spd = spd - 0.36
  1249. end
  1250. wait(0.02)
  1251. end
  1252. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  1253. Torsoz.CFrame = CFrame.new(enz, enz+dir) + Vector3.new(0,3,0)
  1254. end
  1255. bv:remove()
  1256. bg:remove()
  1257. SlideCooldown = 10
  1258. Stand()
  1259. end
  1260.  
  1261. function KD(key)
  1262. if pause.Value == false then
  1263. if key == string.char(32) then
  1264. Space = true
  1265.  
  1266. local ghitz, genz = RAY(Torsoz.Position, Vector3.new(0,-3.7,0))
  1267. local hitz, enz = RAY(Torsoz.Position+Vector3.new(0,1.1,0), Torsoz.CFrame.lookVector*2.3)
  1268. local righthitz, rightenz
  1269. local lefthitz, leftenz
  1270.  
  1271. if HWallRunning == false then
  1272. righthitz, rightenz = RAY(Torsoz.Position, ((Torsoz.CFrame * CFrame.new(1.5,0,-0.2)).p - Torsoz.CFrame.p).unit*3.9)
  1273. lefthitz, leftenz = RAY(Torsoz.Position, ((Torsoz.CFrame * CFrame.new(-1.5,0,-0.2)).p - Torsoz.CFrame.p).unit*3.9)
  1274.  
  1275. elseif HWallRunning == "Jumping" then
  1276. righthitz, rightenz = RAY(Torsoz.Position, ((CFrame.new(Torsoz.Position, Torsoz.Position + HWRDir) * CFrame.new(1.5,0,-0.2)).p - Torsoz.Position).unit*3.9)
  1277. lefthitz, leftenz = RAY(Torsoz.Position, ((CFrame.new(Torsoz.Position, Torsoz.Position + HWRDir) * CFrame.new(-1.5,0,-0.2)).p - Torsoz.Position).unit*3.9)
  1278.  
  1279. end
  1280.  
  1281.  
  1282. if hitz == nil and VWallRunning == "Falling" then
  1283. VWallRunning = "BackflipFromFall"
  1284. end
  1285.  
  1286. if Shift == true and Torsoz.Velocity.y > -50 and Diving == false and DivingCooldown <= 0 then
  1287. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-3.5,0))
  1288.  
  1289. if hitz ~= nil then
  1290. if Action == "Standing" and VWRCooldown == 0 then
  1291. if hitz2 == nil or hitz2.CanCollide == false then
  1292. VWR(hitz, enz)
  1293. end
  1294. end
  1295. end
  1296.  
  1297. if (HWallRunning == false or (HWallRunning == "Jumping" and (HWRLastPart ~= righthitz or HWRLastPart ~= lefthitz))) and HWRCooldown == 0 and VWallRunning == false then
  1298.  
  1299. if (hitz == nil or HWallRunning == "Jumping") and ((righthitz ~= nil and righthitz.Parent:findFirstChild("Humanoid") == nil and righthitz.Parent.className ~= "Hat") or (lefthitz ~= nil and lefthitz.Parent:findFirstChild("Humanoid") == nil and lefthitz.Parent.className ~= "Hat")) then
  1300. if hitz2 == nil or hitz2.CanCollide == false then
  1301. local right = (rightenz - Torsoz.Position).magnitude
  1302. local left = (leftenz - Torsoz.Position).magnitude
  1303. if right < left then
  1304. if HWallRunning == "Jumping" and HWRLastPart ~= righthitz then
  1305. HWallRunning = false
  1306. while Standing == false do
  1307. wait(0.01)
  1308. end
  1309. print("2nd Right Activated!")
  1310. HWallRun(righthitz, rightenz, -math.pi/2)
  1311. else
  1312. if hitz == nil then
  1313. print("Right Activated")
  1314. HWallRun(righthitz, rightenz, -math.pi/2)
  1315. end
  1316. end
  1317. elseif left < right then
  1318. if HWallRunning == "Jumping" and HWRLastPart ~= lefthitz then
  1319. HWallRunning = false
  1320. while Standing == false do
  1321. wait(0.01)
  1322. end
  1323. print("2nd Left Activated!")
  1324. HWallRun(lefthitz, leftenz, math.pi/2)
  1325. else
  1326. if hitz == nil then
  1327. print("Left Activated")
  1328. HWallRun(lefthitz, leftenz, math.pi/2)
  1329. end
  1330. end
  1331. end
  1332. end
  1333. end
  1334. end
  1335.  
  1336. end
  1337.  
  1338. if HWallRunning == true then
  1339. HWallRunning = "Jumping"
  1340. Action = "HWRJumping"
  1341. end
  1342.  
  1343. elseif key == string.char(48) then
  1344. Shift = true
  1345. elseif key == string.char(50) then
  1346. if Action == "Standing" then
  1347. Sit()
  1348. elseif HWallRunning == true then
  1349. HWRGravDrop = true
  1350. end
  1351. elseif key == string.char(52) then
  1352. if Shift == true and Action == "Standing" and SlideCooldown == 0 and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 15 and Torsoz.Velocity.y > -40 then
  1353. print("Sliding")
  1354. Slide()
  1355. end
  1356. elseif key == "a" then
  1357. VWRLeft = true
  1358. elseif key == "d" then
  1359. VWRRight = true
  1360. elseif key == "g" then
  1361. Dive()
  1362. end
  1363. end
  1364. end
  1365.  
  1366. function KU(key)
  1367. if key == string.char(32) then
  1368. Space = false
  1369. elseif key == string.char(48) then
  1370. Shift = false
  1371. elseif key == string.char(50) then
  1372. if Action == "Sitting" then
  1373. Stand()
  1374. end
  1375. elseif key == string.char(52) then
  1376. Sliding = false
  1377. elseif key == "a" then
  1378. VWRLeft = false
  1379. elseif key == "d" then
  1380. VWRRight = false
  1381. end
  1382. end
  1383.  
  1384. mouse.KeyDown:connect(function(key) KD(key) end)
  1385. mouse.KeyUp:connect(function(key) KU(key) end)
  1386.  
  1387. Joint1 = Instance.new("Snap", Torsoz)
  1388. GetWeld(Joint1)
  1389. Joint2 = Instance.new("Snap", Torsoz)
  1390. GetWeld(Joint2)
  1391. Joint3 = Instance.new("Snap", Torsoz)
  1392. GetWeld(Joint3)
  1393. Joint4 = Instance.new("Snap", Torsoz)
  1394. GetWeld(Joint4)
  1395. Joint5 = Instance.new("Snap", Torsoz)
  1396. GetWeld(Joint5)
  1397. Stand()
  1398.  
  1399. local animatebg = Instance.new("BodyGyro")
  1400. animatebg.D = 100
  1401. local GravAction = "Idle"
  1402. local PrevGravAction = GravAction
  1403.  
  1404. local prevrapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  1405. local prevlapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  1406. local hue = 0
  1407. local recyclecount = 0
  1408. local tickoffset = tick()
  1409. local fadetab = {}
  1410. local fadetab2 = {}
  1411. local animatebgcount = 0
  1412.  
  1413. for i = 1, 13 do
  1414. local p = P:Clone()
  1415. p.Name = "Part"..i
  1416. local mesh = Instance.new("SpecialMesh", p)
  1417. mesh.MeshId = "http://www.roblox.com/Asset/?id=9856898"
  1418. mesh.TextureId = "http://www.roblox.com/Asset/?id=48358980"
  1419. table.insert(fadetab, {p, mesh})
  1420. end
  1421. for i = 1, 13 do
  1422. local p = P:Clone()
  1423. p.Name = "Part"..i
  1424. local mesh = Instance.new("SpecialMesh", p)
  1425. mesh.MeshId = "http://www.roblox.com/Asset/?id=9856898"
  1426. mesh.TextureId = "http://www.roblox.com/Asset/?id=48358980"
  1427. table.insert(fadetab2, {p, mesh})
  1428. end
  1429.  
  1430. game:service("RunService").Stepped:connect(function()
  1431. GravAction = "Idle"
  1432. hue = hue + 3
  1433. hue = hue % 360
  1434.  
  1435. ------------- anim angle changing --------
  1436. if animangle > math.pi then
  1437. animplus = false
  1438. elseif animangle < -math.pi then
  1439. animplus = true
  1440. end
  1441. if animplus == true then
  1442. animangle = animangle + animspeed
  1443. elseif animplus == false then
  1444. animangle = animangle - animspeed
  1445. end
  1446.  
  1447. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-3.9,0))
  1448. if Shift == true and GravAction ~= "Falling" then
  1449. Hu.WalkSpeed = sprint
  1450. elseif Shift == false then
  1451. Hu.WalkSpeed = 16
  1452. elseif GravAction == "Falling" then
  1453. Hu.WalkSpeed = 0
  1454. end
  1455. if (FOV >= 70 and FOV < 74) and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 25 then
  1456. FOV = FOV + 1
  1457. elseif (FOV <= 74 and FOV > 70) and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude < 20 then
  1458. FOV = FOV - 1
  1459. end
  1460. if pause.Value == true then
  1461. Hu.WalkSpeed = 0
  1462. end
  1463. if Sitting == true then
  1464. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-2.2,0))
  1465. Hu.PlatformStand = true
  1466. if hitz2 == nil then
  1467. Stand()
  1468. end
  1469. end
  1470. if Diving == true then
  1471. Hu.PlatformStand = true
  1472. DivingBV.velocity = Vector3.new(DivingDir.x*(sprint+2),GravPoint,DivingDir.z*(sprint+2))
  1473. DivingBG.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+DivingBV.velocity) * CFrame.Angles(-math.pi/2,0,0)
  1474.  
  1475. if GravPoint > -180 then
  1476. GravPoint = GravPoint - 2
  1477. end
  1478. end
  1479. if DivingCooldown > 0 then
  1480. DivingCooldown = DivingCooldown - 1
  1481. end
  1482. if HWallRunning == true then
  1483. if HWRGravDrop == false then
  1484. GravPoint = GravPoint - 0.4
  1485. else
  1486. GravPoint = GravPoint - 2
  1487. end
  1488. elseif HWallRunning == "Jumping" then
  1489. GravPoint = GravPoint - 1.7
  1490. end
  1491. ----------------------------- stamina ----------------------------------------
  1492. if Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude > 18 and Action == "Standing" and Shift == true then
  1493. if stamina > 0 then
  1494. stamina = stamina - 0.5
  1495. if stamina < 0 then
  1496. Shift = false
  1497. stamina = 0
  1498. end
  1499. else
  1500. Shift = false
  1501. stamina = 0
  1502. end
  1503. if Action == "Standing" then
  1504. animspeed = 0.85
  1505. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/4.85,0,0))
  1506. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/4.85,0,0))
  1507. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/3.5,0,0))
  1508. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/3.5,0,0))
  1509. end
  1510. elseif Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude > 12 and Action ~= "Sliding" then
  1511. if stamina < maxstamina then
  1512. stamina = stamina + 0.5
  1513. if stamina > maxstamina then
  1514. stamina = maxstamina
  1515. end
  1516. else
  1517. stamina = maxstamina
  1518. end
  1519. if Action == "Standing" then
  1520. animspeed = 0.65
  1521. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/7,0,0))
  1522. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/7,0,0))
  1523. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/5,0,0))
  1524. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/5,0,0))
  1525. end
  1526. elseif Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude < 2 then
  1527. animspeed = 0.1
  1528. if Action == "Standing" then
  1529. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/38,0,0))
  1530. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/38,0,0))
  1531. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/30,0,0))
  1532. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/30,0,0))
  1533. end
  1534. if stamina < maxstamina then
  1535. if Sitting == false then
  1536. stamina = stamina + 0.65
  1537. else
  1538. stamina = stamina + 1.02
  1539. end
  1540. if stamina > maxstamina then
  1541. stamina = maxstamina
  1542. end
  1543. else
  1544. stamina = maxstamina
  1545. end
  1546. end
  1547.  
  1548. if hitz == nil then
  1549. if Torsoz.Velocity.y > 1 or (Torsoz.Velocity.y < -1 and Torsoz.Velocity.y > -90) then
  1550. if Action == "Standing" then
  1551. GravAction = "Rising"
  1552. animspeed = 0.1
  1553. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/38,0,0))
  1554. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/38,0,0))
  1555. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new((math.pi-0.2)+(animangle/30),0,0))
  1556. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new((math.pi-0.2)+(-animangle/30),0,0))
  1557. if animatebg.Parent ~= nil then
  1558. animatebg.Parent = Torsoz
  1559. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  1560. local lokvec = Torsoz.CFrame.lookVector*100
  1561. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z))
  1562. animatebg.Parent = nil
  1563. end
  1564. end
  1565. end
  1566. end
  1567.  
  1568. if hitz == nil then
  1569. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-6,0))
  1570. if hitz2 == nil then
  1571. if Torsoz.Velocity.y < -90 then
  1572. if Action == "Standing" then
  1573. GravAction = "Falling"
  1574. Hu.WalkSpeed = 0
  1575. animspeed = 1.1
  1576. animatebg.Parent = Torsoz
  1577. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  1578. local lokvec = Torsoz.CFrame.lookVector*100
  1579. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z)) * CFrame.Angles(-math.pi/11,animangle/70,0)
  1580. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.45,-0.8,0), Vector3.new((animangle/27)-0.3,0,0.18))
  1581. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.45,-0.8,0), Vector3.new((-animangle/27)-0.3,0,-0.18))
  1582. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.4,0.5,0), Vector3.new((math.pi+0.2)+(animangle/26),0,0.18))
  1583. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.4,0.5,0), Vector3.new((math.pi+0.2)+(-animangle/26),0,-0.18))
  1584. end
  1585. end
  1586. elseif hitz2.CanCollide == true then
  1587. if animatebg.Parent ~= nil then
  1588. animatebg.Parent = Torsoz
  1589. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  1590. local lokvec = Torsoz.CFrame.lookVector*100
  1591. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z))
  1592. animatebg.Parent = nil
  1593. end
  1594. end
  1595. end
  1596.  
  1597. if GravAction == "Idle" and animatebg.Parent ~= nil then
  1598. animatebg.Parent = nil
  1599. end
  1600.  
  1601. if math.abs(tickoffset - tick()) > 0.05 then
  1602. tickoffset = tick()
  1603. local flowcolor = HSV(hue, 0.7,1)
  1604. recyclecount = (recyclecount % #fadetab) + 1
  1605. if flow.Value > 25 then
  1606. local lapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  1607. local rapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  1608. local p = fadetab[recyclecount]
  1609. p[1].Parent = m
  1610. p[1].CFrame = CFrame.new((lapos+prevlapos)/2, lapos)
  1611. p[2].Scale = Vector3.new(0.5,0.5,(lapos-prevlapos).magnitude*2)
  1612. p[2].VertexColor = Vector3.new(flowcolor.r,flowcolor.g,flowcolor.b)
  1613. p[1].Transparency = math.abs((flow.Value/120) - 0.8)
  1614. p[1].Transparency = p[1].Transparency + (1/#fadetab)
  1615. local p = fadetab2[recyclecount]
  1616. p[1].Parent = m
  1617. p[1].CFrame = CFrame.new((rapos+prevrapos)/2, rapos)
  1618. p[2].Scale = Vector3.new(0.5,0.5,(rapos-prevrapos).magnitude*2)
  1619. p[2].VertexColor = Vector3.new(flowcolor.r,flowcolor.g,flowcolor.b)
  1620. p[1].Transparency = math.abs((flow.Value/120) - 0.8)
  1621. p[1].Transparency = p[1].Transparency + (1/#fadetab)
  1622. end
  1623.  
  1624. for i, v in pairs(fadetab) do
  1625. if v[1].Transparency < 0.9 then
  1626. v[1].Transparency = v[1].Transparency + (1/#fadetab)
  1627. fadetab2[i][1].Transparency = fadetab2[i][1].Transparency + (1/#fadetab)
  1628. elseif v[1].Transparency ~= 1 then
  1629. v[1].Transparency = 1
  1630. v[1].Position = Vector3.new(50000,0,0)
  1631. fadetab2[i][1].Transparency = 1
  1632. fadetab2[i][1].Position = Vector3.new(50000,0,0)
  1633. end
  1634. end
  1635.  
  1636. prevrapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  1637. prevlapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  1638. end
  1639.  
  1640. if flow.Value > 140 then
  1641. if char.Parent ~= nil then
  1642. char:remove()
  1643. end
  1644. end
  1645.  
  1646. if flowcooldown > 0 then
  1647. flowcooldown = flowcooldown - 1
  1648. end
  1649. if HWRCooldown > 0 then
  1650. HWRCooldown = HWRCooldown - 1
  1651. end
  1652. if VWRCooldown > 0 then
  1653. if hitz ~= nil and VWRCooldown > 0 then
  1654. VWRCooldown = VWRCooldown - 1
  1655. end
  1656. end
  1657. if SlideCooldown > 0 then
  1658. SlideCooldown = SlideCooldown - 1
  1659. end
  1660.  
  1661. if Action == "HWallRunning" or Action == "VWallRunning" then
  1662. flow.Value = flow.Value + 0.24
  1663. if flow.Value > 100 then
  1664. flow.Value = 100
  1665. end
  1666. flowcooldown = 40
  1667. elseif Action == "Diving" then
  1668. flowcooldown = 30
  1669. elseif Action == "Sliding" then
  1670. flowcooldown = 15
  1671. elseif Action == "Standing" or Action == "Sitting" then
  1672. if flow.Value > 0 and flowcooldown <= 0 then
  1673. flow.Value = flow.Value - 0.37
  1674. if flow.Value < 0 then
  1675. flow.Value = 0
  1676. end
  1677. end
  1678. end
  1679. prevanimbgcount = animatebgcount
  1680. sprint = defsprint + ((flow.Value/100)*2.4)
  1681. PrevGravAction = GravAction
  1682. Calculate()
  1683. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement