Roblox_Xploits

test

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