Advertisement
cat568

Untitled

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