Advertisement
Kid_Sway

Local Script / StarterPack / Wall Run Script For Roblox!

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