deadropz

Parkour

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