Advertisement
memberhero

Parkour Script

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