WDGASTER132

Untitled

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