Filipono120

N1kkRadz's Fixed Parkour Script 2.0

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