deadropz

Untitled

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