JuicePlum6

Parkour script

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