Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 107.80 KB | None | 0 0
  1.  
  2.  
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  5. do
  6. print("FE Compatibility code by Mokiros")
  7. script.Parent = Player.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent and t.Function then
  33. t.Function(...)
  34. end
  35. end
  36. m.TrigEvent = te
  37. UIS.TrigEvent = te
  38.  
  39. Event.OnServerEvent:Connect(function(plr,io)
  40. if plr~=Player then return end
  41. if io.isMouse then
  42. m.Target = io.Target
  43. m.Hit = io.Hit
  44. else
  45. local b = io.UserInputState == Enum.UserInputState.Begin
  46. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  47. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  48. end
  49. for _,t in pairs(CAS.Actions) do
  50. for _,k in pairs(t.Keys) do
  51. if k==io.KeyCode then
  52. t.Function(t.Name,io.UserInputState,io)
  53. end
  54. end
  55. end
  56. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  57. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  58. end
  59. end)
  60. Event.Parent = NLS([==[
  61. local Player = game:GetService("Players").LocalPlayer
  62. local Event = script:WaitForChild("UserInput_Event")
  63.  
  64. local UIS = game:GetService("UserInputService")
  65. local input = function(io,a)
  66. if a then return end
  67. --Since InputObject is a client-side instance, we create and pass table instead
  68. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  69. end
  70. UIS.InputBegan:Connect(input)
  71. UIS.InputEnded:Connect(input)
  72.  
  73. local Mouse = Player:GetMouse()
  74. local h,t
  75. --Give the server mouse data 30 times every second, but only if the values changed
  76. --If player is not moving their mouse, client won't fire events
  77. while wait(1/30) do
  78. if h~=Mouse.Hit or t~=Mouse.Target then
  79. h,t=Mouse.Hit,Mouse.Target
  80. Event:FireServer({isMouse=true,Target=t,Hit=h})
  81. end
  82. end]==],Player.Character)
  83. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  84. end
  85. local player = owner
  86. local mouse = player:GetMouse()
  87. local cam = workspace.CurrentCamera
  88. local char = player.Character
  89. local Torsoz = char:findFirstChild("Torso")
  90. local RA = char:findFirstChild("Right Arm")
  91. local LA = char:findFirstChild("Left Arm")
  92. local RL = char:findFirstChild("Right Leg")
  93. local LL = char:findFirstChild("Left Leg")
  94. local H = char:findFirstChild("Head")
  95. local Hu = char:findFirstChild("Humanoid")
  96. local RS = Torsoz:findFirstChild("Right Shoulder")
  97. local LS = Torsoz:findFirstChild("Left Shoulder")
  98. local RH = Torsoz:findFirstChild("Right Hip")
  99. local LH = Torsoz:findFirstChild("Left Hip")
  100. local N = Torsoz:findFirstChild("Neck")
  101. local NV = Vector3.new(0,0,0)
  102. local FOV = 70
  103. local Shift, Space, Sitting = false,false,false
  104. local GravPoint = 0
  105. local Diving = false
  106. local DivingCooldown = 0
  107. local DivingDir = NV
  108. local DivingCF = CFrame.new(0,0,0)
  109. local DivingBG, DivingBV
  110. local HWallRunning = false
  111. local HWRGravDrop = false
  112. local HWRLastPart
  113. local HWRCooldown = 0
  114. local HWRDir
  115. local VWallRunning = false
  116. local VWRLastPart
  117. local VWRCooldown = 0
  118. local VWRLeft,VWRRight = false,false
  119. local Sliding = false
  120. local SlideCooldown = 0
  121. local Standing = true
  122. local Action = "Standing"
  123. local animplus = true
  124. local animspeed = 0
  125. local animangle = 0.01
  126. local Joint1, Joint2, Joint3, Joint4, Joint5
  127.  
  128. for i, v in pairs(char:children()) do
  129. 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
  130. v:remove()
  131. end
  132. end
  133.  
  134. local loadids = {112474909, 112474911, 112474909}
  135.  
  136. local stamina = 100
  137. local maxstamina = 100
  138. local defsprint = 28
  139. local sprint = defsprint
  140.  
  141. local pause = Instance.new("BoolValue", char)
  142. pause.Name = "Pause"
  143. pause.Value = false
  144. local flow = Instance.new("NumberValue", char)
  145. flow.Name = "Flow"
  146. flow.Value = 0
  147. local flowcooldown = 0
  148.  
  149. local m = Instance.new("Model", char)
  150. m.Name = "FlowChainPartz"
  151.  
  152. local P = Instance.new("Part")
  153. P.Name = "TrailPart"
  154. P.formFactor = "Custom"
  155. P.Size = Vector3.new(0.2,0.2,0.2)
  156. P.Locked = true
  157. P.Anchored = true
  158. P.CanCollide = false
  159. P.TopSurface = 0
  160. P.BottomSurface = 0
  161.  
  162. script.Name = "ParkourSkrip"
  163.  
  164. local hue = 0
  165.  
  166. function HSV(H,S,V)
  167. H = H % 360
  168. local C = V * S
  169. local H2 = H/60
  170. local X = C * (1 - math.abs((H2 %2) -1))
  171. local color = Color3.new(0,0,0)
  172. if H2 <= 0 then
  173. color = Color3.new(C,0,0)
  174. elseif 0 <= H2 and H2 <= 1 then
  175. color = Color3.new(C,X,0)
  176. elseif 1 <= H2 and H2 <= 2 then
  177. color = Color3.new(X,C,0)
  178. elseif 2 <= H2 and H2 <= 3 then
  179. color = Color3.new(0,C,X)
  180. elseif 3 <= H2 and H2 <= 4 then
  181. color = Color3.new(0,X,C)
  182. elseif 4 <= H2 and H2 <= 5 then
  183. color = Color3.new(X,0,C)
  184. elseif 5 <= H2 and H2 <= 6 then
  185. color = Color3.new(C,0,X)
  186. end
  187. local m = V - C
  188. return Color3.new(color.r + m, color.g + m, color.b + m)
  189. end
  190.  
  191. function GetWeld(weld)
  192. if weld:findFirstChild("XAngle") == nil then
  193. local a = Instance.new("NumberValue", weld)
  194. a.Name = "XAngle"
  195. end
  196. if weld:findFirstChild("YAngle") == nil then
  197. local a = Instance.new("NumberValue", weld)
  198. a.Name = "YAngle"
  199. end
  200. if weld:findFirstChild("ZAngle") == nil then
  201. local a = Instance.new("NumberValue", weld)
  202. a.Name = "ZAngle"
  203. end
  204. return weld.C0.p, Vector3.new(weld.XAngle.Value, weld.YAngle.Value, weld.ZAngle.Value)
  205. end
  206.  
  207. function SetWeld(weld, i, loops, origpos,origangle, nextpos,nextangle)
  208. if weld:findFirstChild("XAngle") == nil then
  209. local a = Instance.new("NumberValue", weld)
  210. a.Name = "XAngle"
  211. end
  212. if weld:findFirstChild("YAngle") == nil then
  213. local a = Instance.new("NumberValue", weld)
  214. a.Name = "YAngle"
  215. end
  216. if weld:findFirstChild("ZAngle") == nil then
  217. local a = Instance.new("NumberValue", weld)
  218. a.Name = "ZAngle"
  219. end
  220.  
  221. local tox,toy,toz = 0,0,0
  222. if origangle.x > nextangle.x then
  223. tox = -math.abs(origangle.x - nextangle.x) /loops*i
  224. else
  225. tox = math.abs(origangle.x - nextangle.x) /loops*i
  226. end
  227. if origangle.y > nextangle.y then
  228. toy = -math.abs(origangle.y - nextangle.y) /loops*i
  229. else
  230. toy = math.abs(origangle.y - nextangle.y) /loops*i
  231. end
  232. if origangle.z > nextangle.z then
  233. toz = -math.abs(origangle.z - nextangle.z) /loops*i
  234. else
  235. toz = math.abs(origangle.z - nextangle.z) /loops*i
  236. end
  237.  
  238. local tox2,toy2,toz2 = 0,0,0
  239. if origpos.x > nextpos.x then
  240. tox2 = -math.abs(origpos.x - nextpos.x) /loops*i
  241. else
  242. tox2 = math.abs(origpos.x - nextpos.x) /loops*i
  243. end
  244. if origpos.y > nextpos.y then
  245. toy2 = -math.abs(origpos.y - nextpos.y) /loops*i
  246. else
  247. toy2 = math.abs(origpos.y - nextpos.y) /loops*i
  248. end
  249. if origpos.z > nextpos.z then
  250. toz2 = -math.abs(origpos.z - nextpos.z) /loops*i
  251. else
  252. toz2 = math.abs(origpos.z - nextpos.z) /loops*i
  253. end
  254.  
  255. weld.XAngle.Value = origangle.x + tox
  256. weld.YAngle.Value = origangle.y + toy
  257. weld.ZAngle.Value = origangle.z + toz
  258. weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz)
  259. end
  260.  
  261. function LoadTextures()
  262. local pls = game:service("ContentProvider")
  263. for i, v in pairs(loadids) do
  264. pls:Preload("http://www.roblox.com/asset/?id="..v)
  265. wait(0.04)
  266. end
  267. end
  268. LoadTextures()
  269.  
  270. function CreateGui()
  271. for i, v in pairs(player.PlayerGui:children()) do
  272. if v.className == "ScreenGui" and v.Name == "staminaGui" then
  273. v:remove()
  274. end
  275. end
  276. local g = Instance.new("ScreenGui", player.PlayerGui)
  277. g.Name = "staminaGui"
  278.  
  279. local c = Instance.new("Frame", g)
  280. c.Visible = false
  281. c.Size = UDim2.new(0,86,0,320)
  282. c.BackgroundTransparency = 1
  283. c.Position = UDim2.new(1,-96,0.5,-160)
  284. c.Name = "Container"
  285.  
  286. local t = Instance.new("TextLabel", c)
  287. t.Size = UDim2.new(0,0,-0.1,0)
  288. t.Position = UDim2.new(0.3,0,0.5,0)
  289. t.TextXAlignment = "Right"
  290. t.Font = "ArialBold"
  291. t.TextTransparency = 0.1
  292. t.TextColor3 = Color3.new(0,0.6,0.8)
  293. t.TextStrokeColor3 = Color3.new(0,0.2,0.8)
  294. t.TextStrokeTransparency = 0.3
  295. t.FontSize = 6
  296. t.BackgroundTransparency = 1
  297. local t2 = t:Clone()
  298. t2.Parent = c
  299. t2.Size = UDim2.new(0,0,0.1,0)
  300. local l = t:Clone()
  301. l.Parent = c
  302. l.Size = UDim2.new(0,0,0,0)
  303. l.Text = "-----"
  304.  
  305. local f1 = Instance.new("Frame", c)
  306. f1.Name = "Backing"
  307. f1.ClipsDescendants = true
  308. f1.Size = UDim2.new(1,0,0,0)
  309. f1.BackgroundColor3 = Color3.new(0.8,0,0)
  310. f1.BackgroundTransparency = 1
  311. local f1img = Instance.new("ImageLabel", f1)
  312. f1img.BackgroundTransparency = 1
  313. f1img.Image = "http://www.roblox.com/asset/?id=112474909"
  314. f1img.Size = UDim2.new(1,0,0,c.Size.Y.Offset)
  315.  
  316. local f2 = Instance.new("Frame", c)
  317. f2.Name = "Overlay"
  318. f2.ClipsDescendants = true
  319. f2.Size = UDim2.new(1,0,1,0)
  320. f2.BackgroundColor3 = Color3.new(0,0,0.8)
  321. f2.BackgroundTransparency = 1
  322. local f2img = Instance.new("ImageLabel", f2)
  323. f2img.BackgroundTransparency = 1
  324. f2img.Image = "http://www.roblox.com/asset/?id=112474911"
  325. f2img.Size = UDim2.new(1,0,0,c.Size.Y.Offset)
  326.  
  327. function Calculate()
  328. local ysize = c.Size.Y.Offset
  329. local per = (stamina/maxstamina) * c.Size.Y.Offset
  330. local rem = (-(stamina/maxstamina-1)) * c.Size.Y.Offset
  331. f1.Size = UDim2.new(1,0,0,rem)
  332. f2.Size = UDim2.new(1,0,0,per)
  333. f2.Position = UDim2.new(0,0,0,rem)
  334. f2img.Position = UDim2.new(0,0,0,-rem)
  335. t.Text = math.floor(stamina)
  336. t2.Text = maxstamina
  337. end
  338. Calculate()
  339.  
  340. wait(0.01)
  341. c.Visible = true
  342. end
  343. CreateGui()
  344.  
  345. player.CharacterAdded:connect(function()
  346. char = player.Character
  347. Torsoz = char:findFirstChild("Torso")
  348. RA = char:findFirstChild("Right Arm")
  349. LA = char:findFirstChild("Left Arm")
  350. RL = char:findFirstChild("Right Leg")
  351. LL = char:findFirstChild("Left Leg")
  352. H = char:findFirstChild("Head")
  353. Hu = char:findFirstChild("Humanoid")
  354. RS = Torsoz:findFirstChild("Right Shoulder")
  355. LS = Torsoz:findFirstChild("Left Shoulder")
  356. RH = Torsoz:findFirstChild("Right Hip")
  357. LH = Torsoz:findFirstChild("Left Hip")
  358. N = Torsoz:findFirstChild("Neck")
  359. stamina = maxstamina
  360. CreateGui()
  361. end)
  362.  
  363. function RAY(pos, dir, startpos, endpos, distleft, collidedlist)
  364. collidedlist = collidedlist or {char}
  365. startpos = startpos or pos
  366. distleft = distleft or dir.unit * dir.magnitude
  367. endpos = endpos or pos + distleft
  368. local ray = Ray.new(pos, distleft)
  369. local hitz,enz = workspace:FindPartOnRayWithIgnoreList(ray, collidedlist)
  370. --[[
  371. local p = P:Clone()
  372. p.Parent = char
  373. p.Size = Vector3.new(0.4,0.4,0.4)
  374. p.BrickColor = BrickColor.new("Lime green")
  375. p.CanCollide = false
  376. p.CFrame = CFrame.new(enz)
  377. p.Transparency = 0.3
  378. ]]
  379. if hitz ~= nil then
  380. if hitz.CanCollide == false then
  381. table.insert(collidedlist, hitz)
  382. local newpos = enz
  383. local newdistleft = distleft - (dir.unit * (pos - newpos).magnitude)
  384. if newdistleft ~= NV then
  385. return RAY(newpos-(dir*0.01), dir, startpos, endpos, newdistleft+(dir*0.01), collidedlist)
  386. end
  387. end
  388. end
  389.  
  390. return hitz, enz, ray
  391. end
  392.  
  393. function Sit()
  394. Standing = false
  395. local hitz,enz = RAY(Torsoz.Position, Vector3.new(0,-4.1,0))
  396. local tordir = Vector3.new(Torsoz.CFrame.lookVector.x,0,Torsoz.CFrame.lookVector.z)
  397. if (hitz ~= nil and hitz.CanCollide == true) then
  398. 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)
  399. local hitz2,enz2 = RAY(enz+Vector3.new(0,2.25,0), tordir*-2.2)
  400. Hu.PlatformStand = true
  401. Torsoz.CFrame = cf
  402. local bp = Instance.new("BodyPosition", Torsoz)
  403. bp.Name = "StaminaBodyObject"
  404. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  405. bp.D = 100
  406. bp.position = cf.p
  407. local bg = Instance.new("BodyGyro", Torsoz)
  408. bg.Name = "StaminaBodyObject"
  409. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  410. bg.cframe = cf
  411. bg.D = 100
  412. 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))
  413. 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))
  414.  
  415. if hitz2 ~= nil and hitz2.CanCollide == true then
  416. 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)
  417. 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)
  418. Joint5.C0 = CFrame.new(0,1,0) * CFrame.Angles(-math.pi/8.8,0,0)
  419. else
  420. 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))
  421. 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))
  422. SetWeld(Joint5,1,1, NV,NV, Vector3.new(0,1,0), Vector3.new(-math.pi/12,0,0))
  423. end
  424.  
  425. Sitting = true
  426. Action = "Sitting"
  427. end
  428. end
  429.  
  430.  
  431. function Stand()
  432. Hu.PlatformStand = false
  433. if Sitting == true then
  434. local tordir = Torsoz.Position + (Torsoz.CFrame.lookVector*10000)
  435. local cf = CFrame.new(Torsoz.Position + Vector3.new(0,1.8,0), Vector3.new(tordir.x,Torsoz.Position.y,tordir.z))
  436. Torsoz.CFrame = cf
  437. end
  438. for i, v in pairs(Torsoz:children()) do
  439. if v.Name == "StaminaBodyObject" then
  440. v:remove()
  441. end
  442. end
  443. RH.Part0 = nil
  444. LH.Part0 = nil
  445. RS.Part0 = nil
  446. LS.Part0 = nil
  447. Joint1.Part0 = Torsoz
  448. Joint1.Part1 = RL
  449. Joint1.C0 = CFrame.new(0.5,-1,0)
  450. Joint1.C1 = CFrame.new(0,1,0)
  451. Joint2.Part0 = Torsoz
  452. Joint2.Part1 = LL
  453. Joint2.C0 = CFrame.new(-0.5,-1,0)
  454. Joint2.C1 = CFrame.new(0,1,0)
  455. Joint3.Part0 = Torsoz
  456. Joint3.Part1 = RA
  457. Joint3.C0 = CFrame.new(1.5,0.5,0)
  458. Joint3.C1 = CFrame.new(0,0.5,0)
  459. Joint4.Part0 = Torsoz
  460. Joint4.Part1 = LA
  461. Joint4.C0 = CFrame.new(-1.5,0.5,0)
  462. Joint4.C1 = CFrame.new(0,0.5,0)
  463. Joint5.Part0 = Torsoz
  464. Joint5.Part1 = H
  465. Joint5.C0 = CFrame.new(0,1,0)
  466. Joint5.C1 = CFrame.new(0,-0.5,0)
  467. Sitting = false
  468. Diving = false
  469. Standing = true
  470. Action = "Standing"
  471. end
  472.  
  473. --------------------------------------- Dive ----------------------------------
  474.  
  475. function Dive()
  476. stamina = stamina - 10
  477. flow.Value = flow.Value + 10
  478. if flow.Value > 100 then
  479. flow.Value = 100
  480. end
  481. Standing = false
  482. local dir = Vector3.new(Torsoz.CFrame.lookVector.x,0,Torsoz.CFrame.lookVector.z)
  483. GravPoint = 18
  484. DivingDir = dir
  485. local cf = CFrame.new(Torsoz.Position, dir+Vector3.new(0,Torsoz.Position.y,0))
  486. DivingCF = cf
  487. DivingDir = dir
  488. Hu.PlatformStand = true
  489. local bv = Instance.new("BodyVelocity", Torsoz)
  490. bv.Name = "StaminaBodyObject"
  491. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  492. bv.velocity = Vector3.new(DivingDir.x*24,GravPoint,DivingDir.z*24)
  493. DivingBV = bv
  494. local bg = Instance.new("BodyGyro", Torsoz)
  495. bg.Name = "StaminaBodyObject"
  496. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  497. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+bv.velocity) * CFrame.Angles(-math.pi/2,0,0)
  498. bg.D = 100
  499. DivingBG = bg
  500.  
  501. local joint = Joint3
  502. joint.C1 = CFrame.new(0,0.5,0)
  503. local joint2 = Joint4
  504. joint2.C1 = CFrame.new(0,0.5,0)
  505. local joint3 = Joint1
  506. joint3.C1 = CFrame.new(0,1,0)
  507. local joint4 = Joint2
  508. joint4.C1 = CFrame.new(0,1,0)
  509.  
  510. local joint5 = Joint5
  511.  
  512. Diving = true
  513. Action = "Diving"
  514.  
  515. for i = 1, 8 do
  516. 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))
  517. 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))
  518. 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))
  519. 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))
  520. SetWeld(joint5,i,8, Vector3.new(0,1,0), NV, Vector3.new(0,1,0), Vector3.new(0.45,0,0))
  521. wait(0.025)
  522. end
  523.  
  524. local counter = 0
  525. while Diving == true do
  526. counter = counter + 1
  527. bg.Parent = Torsoz
  528. local hitz, enz = RAY(Torsoz.Position, bv.velocity.unit*4.6)
  529. if hitz ~= nil and hitz.CanCollide == true then
  530. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-4,0))
  531. if hitz2 ~= nil then
  532. Diving = "Rolling"
  533. Action = "DiveRolling"
  534. else
  535. Torsoz.CFrame = Torsoz.CFrame * CFrame.new(0,-0.3,0)
  536. Torsoz.Velocity = NV
  537. flow.Value = 0
  538. break
  539. end
  540. end
  541. if counter > 190 then
  542. break
  543. end
  544. wait(0.02)
  545. end
  546.  
  547. bv.velocity = (dir*20) + Vector3.new(0,-0.5,0)
  548.  
  549. local bgcf = bg.cframe
  550. local haslanded = false
  551. local count = 0
  552.  
  553. while haslanded == false do
  554. bg.cframe = bgcf * CFrame.Angles(-0.3*count,0,0)
  555. local hitz, enz = RAY(Torsoz.Position, ((Torsoz.CFrame*CFrame.new(0,-1,0)).p - Torsoz.CFrame.p).unit*1.6)
  556. if hitz ~= nil and hitz.CanCollide == true then
  557. haslanded = true
  558. end
  559. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-3.8,0))
  560. if hitz2 == nil then
  561. Torsoz.Velocity = NV
  562. break
  563. elseif haslanded == true then
  564. local bp = Instance.new("BodyPosition", Torsoz)
  565. bp.Name = "StaminaJumpFix"
  566. bp.maxForce = Vector3.new(0,1/0,0)
  567. bp.P = 7000
  568. bp.position = enz2 + Vector3.new(0,2.8,0)
  569. game:service("Debris"):AddItem(bp, 0.3)
  570. else
  571. bv.velocity = (dir*20) + Vector3.new(0,-(Torsoz.Position - enz2).magnitude*3,0)
  572.  
  573. end
  574. count = count + 1
  575. if count <= 6 then
  576. local i = count
  577. local j1,j1a = GetWeld(joint)
  578. local j2,j2a = GetWeld(joint2)
  579. local j3,j3a = GetWeld(joint3)
  580. local j4,j4a = GetWeld(joint4)
  581. local j5,j5a = GetWeld(joint5)
  582. 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))
  583. 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))
  584. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.51,0.4,-0.6), Vector3.new(-0.1,0,0.05))
  585. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.51,0.4,-0.6), Vector3.new(-0.1,0,-0.05))
  586. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,1,0), Vector3.new(-0.4,0,0))
  587. elseif count >= 50 then
  588. break
  589. end
  590. wait(0.02)
  591. end
  592.  
  593. Torsoz.Velocity = NV
  594.  
  595. Stand()
  596. DivingCooldown = 9
  597. end
  598.  
  599. function FindSurface(part, position)
  600. local obj = part.CFrame:pointToObjectSpace(position)
  601. local siz = part.Size/2
  602. for i,v in pairs(Enum.NormalId:GetEnumItems()) do
  603. local vec = Vector3.FromNormalId(v)
  604. local wvec = part.CFrame:vectorToWorldSpace(vec)
  605. local vz = (obj)/(siz*vec)
  606. 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
  607. return wvec,vec
  608. end
  609. end
  610. if part.className == "WedgePart" then
  611. return part.CFrame:vectorToWorldSpace(Vector3.new(0,0.707,-0.707)), Vector3.new(0,0.707,-0.707)
  612. end
  613. end
  614.  
  615. function HWallRun(part, pos, side)
  616. if (part.className == "Part" and part.Shape == Enum.PartType.Block) or part.className ~= "Part" then
  617. flow.Value = flow.Value + 9
  618. Standing = false
  619. HWallRunning = true
  620. Action = "HWallRunning"
  621. GravPoint = 10
  622. HWRLastPart = part
  623. local dir, dirc = FindSurface(part, pos)
  624. towall = -dir
  625. dir = (CFrame.new(NV, dir) * CFrame.Angles(0,side,0)).lookVector
  626.  
  627. local bv = Instance.new("BodyVelocity", Torsoz)
  628. bv.Name = "StaminaBodyObject"
  629. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  630. bv.P = 9000
  631. bv.velocity = (dir*(sprint-0.5)) + Vector3.new(0,GravPoint,0)
  632. local bg = Instance.new("BodyGyro", Torsoz)
  633. bg.Name = "StaminaBodyObject"
  634. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  635. bg.cframe = CFrame.new(Torsoz.Position+(towall*-2), Torsoz.Position) * CFrame.Angles(0,-side,-side/4.2)
  636. bg.D = 100
  637.  
  638. local sid = Instance.new("Snap")
  639.  
  640. local joint1 = Joint3
  641. if side == -math.pi/2 then
  642. 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))
  643. else
  644. sid = joint1
  645. SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.6,0), Vector3.new(-math.pi/12,0,math.pi/7))
  646. end
  647. local j1c0 = joint1.C0
  648.  
  649. local joint2 = Joint4
  650. if side == math.pi/2 then
  651. 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))
  652. else
  653. sid = joint2
  654. SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.6,0), Vector3.new(-math.pi/12,0,-math.pi/7))
  655. end
  656. local j2c0 = joint2.C0
  657.  
  658. local joint3 = Joint1
  659. joint3.C1 = CFrame.new(0,1,0)
  660. if side == -math.pi/2 then
  661. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.5,-0.38,-0.3), Vector3.new(0,math.pi/2,0.14))
  662. else
  663. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.5,-0.8,-0.2), Vector3.new(0,math.pi/2,0.2))
  664. end
  665.  
  666. local joint4 = Joint2
  667. joint4.C1 = CFrame.new(0,1,0)
  668. if side == -math.pi/2 then
  669. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.5,-0.8,-0.2), Vector3.new(0,0,0.2))
  670. else
  671. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.5,-0.38,-0.3), Vector3.new(0,0,0.14))
  672. end
  673.  
  674. local joint5 = Joint5
  675. SetWeld(joint5,1,1,NV,NV,Vector3.new(0,0.9,0),Vector3.new(0,0,side/7))
  676.  
  677. Torsoz.CFrame = CFrame.new(pos+(towall*-2), pos) * CFrame.Angles(0,-side,-side/2.2)
  678. bg.cframe = CFrame.new(pos+(towall*-2), pos) * CFrame.Angles(0,-side,-side/2.2)
  679.  
  680. local aniangle = 0
  681. local aniplus = true
  682. local aniangle2 = 0
  683. local aniplus2 = true
  684.  
  685. local prevpart = part
  686. HWRLastPart = part
  687. while HWallRunning == true do
  688.  
  689. if aniangle > math.pi then
  690. aniplus = false
  691. elseif aniangle < -math.pi then
  692. aniplus = true
  693. end
  694. if aniplus == true then
  695. aniangle = aniangle + 0.95
  696. elseif aniplus == false then
  697. aniangle = aniangle - 0.95
  698. end
  699.  
  700. if aniangle2 > math.pi then
  701. aniplus2 = false
  702. elseif aniangle2 < -math.pi then
  703. aniplus2 = true
  704. end
  705. if aniplus2 == true then
  706. aniangle2 = aniangle2 + 0.23
  707. elseif aniplus2 == false then
  708. aniangle2 = aniangle2 - 0.23
  709. end
  710.  
  711. Hu.PlatformStand = true
  712. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-3,0))
  713. local hitz2, enz2 = RAY(Torsoz.Position, towall*3.4)
  714.  
  715. --- if player ends wall run on ground
  716. if hitz ~= nil and hitz.CanCollide == true then
  717. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,0)
  718. local offset = (bg.cframe.p.y+enz2.y) - bg.cframe.p.y
  719. Torsoz.CFrame = CFrame.new(Vector3.new(bg.cframe.p.x,offset,bg.cframe.p.z), enz2) * CFrame.Angles(0,-side,0)
  720. Torsoz.Velocity = NV
  721. break
  722. end
  723.  
  724. ---- if new wall found --------
  725. if hitz2 ~= nil and hitz2.CanCollide == true then
  726. if hitz2 ~= prevpart then
  727. local direct = CFrame.new(Torsoz.Position, Torsoz.Position+dir) * CFrame.Angles(0,side,0)
  728. local hitz3, enz3 = RAY(Torsoz.Position, (direct * CFrame.Angles(0,-side/2.3,0)).lookVector*4)
  729. if hitz3 ~= nil then
  730. Torsoz.CFrame = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side*1.1,-side/2.2)
  731. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side*1.1,-side/2.2)
  732. dir, dirc = FindSurface(hitz2, enz2)
  733. towall = -dir
  734. dir = (CFrame.new(NV, dir) * CFrame.Angles(0,side,0)).lookVector
  735. prevpart = hitz2
  736. HWRLastPart = hitz2
  737. else
  738. ---- if player fails to find new wall to run on
  739. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  740. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  741. Torsoz.Velocity = NV
  742. HWRCooldown = 8
  743. break
  744. end
  745. end
  746. --- continue to wall run
  747. Torsoz.CFrame = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,-side/2.2)
  748. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,-side/2.2)
  749. else
  750. ---- if player ends wall run at end of wall
  751. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  752. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  753. Torsoz.Velocity = NV
  754. HWRCooldown = 8
  755. break
  756. end
  757.  
  758. local hitz3, enz3 = RAY(Torsoz.Position, Torsoz.CFrame.lookVector*2)
  759. if hitz3 ~= nil and hitz3.CanCollide == true then
  760. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  761. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  762. Torsoz.Velocity = NV
  763. HWRCooldown = 8
  764. break
  765. end
  766.  
  767. bv.Parent = Torsoz
  768. bv.velocity = (dir*(sprint-0.5)) + Vector3.new(0,GravPoint,0)
  769. bg.cframe = bg.cframe * CFrame.Angles(aniangle/80,aniangle/80,0)
  770. Torsoz.CFrame = Torsoz.CFrame * CFrame.Angles(aniangle/80,aniangle/80,0)
  771. local j3,j3a = GetWeld(joint3)
  772. local j4,j4a = GetWeld(joint4)
  773. SetWeld(joint3,1,1, j3,j3a, j3,Vector3.new(-0.2+(aniangle/4),0,0))
  774. SetWeld(joint4,1,1, j4,j4a, j4,Vector3.new(-0.2+(-aniangle/4),0,0))
  775. if side == math.pi/2 then
  776. local j1,j1a = GetWeld(joint1)
  777. SetWeld(joint1,1,1, j1,j1a, j1, Vector3.new(0,0,0.8+(aniangle2/14)))
  778. else
  779. local j2,j2a = GetWeld(joint2)
  780. SetWeld(joint2,1,1, j2,j2a, j2, Vector3.new(0,0,-0.8-(aniangle2/14)))
  781. end
  782.  
  783. wait(0.025)
  784. if GravPoint < -100 then
  785. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,0)
  786. local offset = math.abs((bg.cframe.p.y+enz2.y) - bg.cframe.p.y)
  787. Torsoz.CFrame = CFrame.new(Vector3.new(bg.cframe.p.x,offset,bg.cframe.p.z), enz2) * CFrame.Angles(0,-side,0)
  788. break
  789. end
  790.  
  791. end
  792.  
  793. if HWallRunning == "Jumping" then
  794. HWRCooldown = 6
  795. joint1.C1 = CFrame.new(0,0.5,0)
  796.  
  797. joint2.C1 = CFrame.new(0,0.5,0)
  798. if side == -math.pi/2 then
  799. joint2.C0 = CFrame.new(-1.35,0.5,0) * CFrame.Angles(0,side/2.4,-math.pi/3)
  800. else
  801. joint2.C0 = CFrame.new(-1.35,0.5,0) * CFrame.Angles(0,side/2.4,-math.pi/4)
  802. end
  803.  
  804. joint3.C1 = CFrame.new(0,1,0)
  805. if side == -math.pi/2 then
  806. joint3.C0 = CFrame.new(0.5,-0.8,0) * CFrame.Angles(0,math.pi+(side/2.4),-math.pi/4)
  807. else
  808. joint3.C0 = CFrame.new(0.5,-0.8,0) * CFrame.Angles(0,(side/2.4),math.pi/4)
  809. end
  810. joint4.MaxVelocity = 10
  811. joint4.DesiredAngle = 0
  812. joint4.C1 = CFrame.new(0,1,0)
  813. if side == -math.pi/2 then
  814. joint4.C0 = CFrame.new(-0.5,-0.8,0) * CFrame.Angles(0,math.pi+(side/2.4),math.pi/4)
  815. else
  816. joint4.C0 = CFrame.new(-0.5,-0.8,0) * CFrame.Angles(0,(side/2.4),-math.pi/4)
  817. end
  818.  
  819. local joint5 = Joint5
  820. joint5.C1 = CFrame.new(0,-0.5,0) * CFrame.Angles(0,side/2.4,0)
  821. joint5.C0 = CFrame.new(0,1,0)
  822.  
  823. local j1,j1a = GetWeld(joint1)
  824. local j2,j2a = GetWeld(joint2)
  825. local j3,j3a = GetWeld(joint3)
  826. local j4,j4a = GetWeld(joint4)
  827. local j5,j5a = GetWeld(joint5)
  828.  
  829. GravPoint = 26
  830. local collidecount = 0
  831. local bgangle = side/2
  832. local count = 1
  833. local dir2 = (CFrame.new(NV, dir) * CFrame.Angles(0,-side/2.4,0)).lookVector
  834. HWRDir = dir2
  835. bv.velocity = (dir2*(sprint+5)) + Vector3.new(0,GravPoint,0)
  836. while HWallRunning == "Jumping" do
  837. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-4,0))
  838. local hitz2, enz2 = RAY(Torsoz.Position, dir2*1.4)
  839. if hitz ~= nil and hitz.CanCollide == true then
  840. local offset = math.abs(enz.y - Torsoz.CFrame.p.y)
  841. Torsoz.CFrame = CFrame.new(enz+Vector3.new(0,2.9,0), enz+Vector3.new(0,2.9,0)+dir2)
  842. Torsoz.Velocity = NV
  843. break
  844. end
  845.  
  846. if hitz2 ~= nil and hitz2.CanCollide == true then
  847. collidecount = collidecount + 1
  848. if collidecount == 4 then
  849. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir2) * CFrame.new(0,0,0.4)
  850. Torsoz.Velocity = Vector3.new(0,Torsoz.Velocity.y,0)
  851. HWRCooldown = 5
  852. VWRCooldown = 5
  853. wait(0.02)
  854. break
  855. end
  856. end
  857.  
  858. if side/2 > 0 then
  859. if bgangle > 0.2 then
  860. bgangle = bgangle - 0.055
  861. end
  862. else
  863. if bgangle < -0.2 then
  864. bgangle = bgangle + 0.055
  865. end
  866. end
  867.  
  868. if count <= 5 then
  869. if side == -math.pi/2 then
  870. SetWeld(joint1,count,5, j1,j1a, Vector3.new(1.35,0.5,0), Vector3.new(0,side/2.4,math.pi/4))
  871. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-1.35,0.5,0), Vector3.new(0,side/2.4,-math.pi/3))
  872. SetWeld(joint3,count,5, j3,j3a, Vector3.new(0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  873. joint3.C0 = joint3.C0 * CFrame.Angles((-math.pi/4)/5*count,0,0)
  874. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  875. joint4.C0 = joint4.C0 * CFrame.Angles((math.pi/4)/5*count,0,0)
  876. else
  877. SetWeld(joint1,count,5, j1,j1a, Vector3.new(1.35,0.5,0), Vector3.new(0,side/2.4,math.pi/3))
  878. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-1.35,0.5,0), Vector3.new(0,side/2.4,-math.pi/4))
  879. SetWeld(joint3,count,5, j3,j3a, Vector3.new(0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  880. joint3.C0 = joint3.C0 * CFrame.Angles((math.pi/4)/5*count,0,0)
  881. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  882. joint4.C0 = joint4.C0 * CFrame.Angles((-math.pi/4)/5*count,0,0)
  883. end
  884.  
  885. count = count + 1
  886. end
  887.  
  888. bg.Parent = Torsoz
  889. bg.cframe = CFrame.new(NV, dir) * CFrame.Angles(0,side/15,-bgangle)
  890. bv.velocity = (dir2*(sprint+5)) + Vector3.new(0,GravPoint,0)
  891. if collidecount ~= 0 then
  892. bv.velocity = Vector3.new(0,bv.velocity.y,0)
  893. end
  894. if GravPoint < -120 then
  895. break
  896. end
  897. wait(0.025)
  898. end
  899. end
  900.  
  901. Hu.PlatformStand = false
  902. bv:remove()
  903.  
  904. HWRGravDrop = false
  905. Stand()
  906. HWallRunning = false
  907. end
  908. end
  909.  
  910. function VWR(part, pos)
  911. if (part.className == "Part" and part.Shape == Enum.PartType.Block) or part.className ~= "Part" then
  912. print("VWR Activated")
  913. flow.Value = flow.Value + 9
  914. Standing = false
  915. VWallRunning = true
  916. Action = "VWallRunning"
  917. GravPoint = 0
  918. local percent = 1
  919. VWRLastPart = part
  920. local dir, dirc = FindSurface(part, pos)
  921. towall = -dir
  922. dir = (CFrame.new(NV, -dir) * CFrame.Angles(math.pi/2,0,0)).lookVector
  923. --[[
  924. local p = P:Clone()
  925. p.Parent = char
  926. p.Size = Vector3.new(2,2,2)
  927. p.BrickColor = BrickColor.new("Lime green")
  928. p.CanCollide = false
  929. p.CFrame = part.CFrame * CFrame.new(dirc*5)
  930. p.Transparency = 0.3
  931. ]]
  932. local bv = Instance.new("BodyVelocity", Torsoz)
  933. bv.Name = "StaminaBodyObject"
  934. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  935. bv.P = 9000
  936. bv.velocity = (dir*(sprint-1))*percent
  937.  
  938. local bg = Instance.new("BodyGyro", Torsoz)
  939. bg.Name = "StaminaBodyObject"
  940. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  941. bg.D = 100
  942. local posi = pos + (-towall*1.8)
  943. bg.cframe = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0)
  944. Torsoz.CFrame = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0)
  945.  
  946. local joint1 = Joint3
  947. SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,0,math.pi/8))
  948.  
  949. local joint2 = Joint4
  950. SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,0,-math.pi/8))
  951.  
  952. local joint3 = Joint1
  953. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.48,-0.6,-0.1), Vector3.new(0,math.pi/2,0))
  954. joint3.C1 = CFrame.new(0,0.7,0.2) * CFrame.Angles(0,math.pi/2,0)
  955.  
  956. local joint4 = Joint2
  957. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.48,-0.6,-0.1), Vector3.new(0,math.pi/2,0))
  958. joint4.C1 = CFrame.new(0,0.7,0.2) * CFrame.Angles(0,math.pi/2,0)
  959.  
  960. local joint5 = Joint5
  961. SetWeld(joint5,1,1, NV,NV, Vector3.new(0,1,0), Vector3.new(math.pi/20,0,0))
  962.  
  963. local aniangle = 0
  964. local aniplus = true
  965.  
  966. while VWallRunning == true do
  967. local hitz, enz = RAY(Torsoz.Position, towall*2.1)
  968. local hitz2, enz2 = RAY(Torsoz.Position, (CFrame.new(NV,towall)*CFrame.Angles(math.pi/2,0,0)).lookVector*2.4)
  969.  
  970. if aniangle > math.pi then
  971. aniplus = false
  972. elseif aniangle < -math.pi then
  973. aniplus = true
  974. end
  975. if aniplus == true then
  976. aniangle = aniangle + (1.3*(percent+0.2))
  977. elseif aniplus == false then
  978. aniangle = aniangle - (1.3*(percent+0.2))
  979. end
  980.  
  981. bv.velocity = (dir*(sprint-1))*percent
  982. if VWRLeft == true then
  983. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * (11*percent+5))
  984. end
  985. if VWRRight == true then
  986. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * (11*percent+5))
  987. end
  988.  
  989. bg.cframe = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0) * CFrame.Angles(0,aniangle/60,0)
  990.  
  991. 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)))
  992. 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)))
  993. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.51,-0.75,-(aniangle/30)), Vector3.new(0,math.pi/2,(aniangle/8)-0.3))
  994. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.51,-0.75,(aniangle/30)), Vector3.new(0,math.pi/2,(-aniangle/8)-0.3))
  995.  
  996. if hitz == nil then
  997. local lv = Torsoz.Position + (Torsoz.CFrame.lookVector*100)
  998. Torsoz.CFrame = CFrame.new(Torsoz.Position, Vector3.new(lv.x,Torsoz.Position.y,lv.z))
  999. break
  1000. end
  1001.  
  1002. if hitz2 ~= nil then
  1003. percent = 0
  1004. VWallRunning = "Falling"
  1005. Action = "VWRFalling"
  1006. GravPoint = -7
  1007. break
  1008. end
  1009.  
  1010. wait(0.02)
  1011. percent = percent - 0.028
  1012. if percent <= 0.15 then
  1013. VWallRunning = "Falling"
  1014. Action = "VWRFalling"
  1015. end
  1016. end
  1017.  
  1018. -------------------------- Falling from VWR ------------------------------
  1019. if VWallRunning == "Falling" then
  1020. GravPoint = GravPoint - 1
  1021. local dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  1022. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  1023.  
  1024. local j1,j1a = GetWeld(joint1)
  1025. local j2,j2a = GetWeld(joint2)
  1026. local j3,j3a = GetWeld(joint3)
  1027. local j4,j4a = GetWeld(joint4)
  1028. local j5,j5a = GetWeld(joint5)
  1029.  
  1030. local counter = 0
  1031. while VWallRunning == "Falling" do
  1032. counter = counter + 1
  1033. local hitz, enz = RAY(H.Position, Vector3.new(0,-2.4,0))
  1034.  
  1035. dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  1036. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  1037. if VWRLeft == true then
  1038. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  1039. end
  1040. if VWRRight == true then
  1041. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  1042. end
  1043. bg.cframe = CFrame.new(NV, (-towall*30) + Vector3.new(0,GravPoint,0)) * CFrame.Angles(-math.pi/2.55,math.pi,0)
  1044.  
  1045. if counter <= 35 then
  1046. SetWeld(joint1,counter,35, j1,j1a, Vector3.new(1.4,0.45,-0.1), Vector3.new(math.pi/9,0,math.pi/9))
  1047. SetWeld(joint2,counter,35, j2,j2a, Vector3.new(-1.4,0.45,-0.1), Vector3.new(math.pi/9,0,-math.pi/9))
  1048. SetWeld(joint3,counter,35, j3,j3a, Vector3.new(0.5,-0.75,0), Vector3.new(0,math.pi/2,math.pi/9))
  1049. joint3.C1 = CFrame.new(0,0.7 + (0.3/35*counter),0.2 - (0.2/35*counter)) * CFrame.Angles(0,math.pi/2,0)
  1050. SetWeld(joint4,counter,35, j4,j4a, Vector3.new(-0.5,-0.75,0), Vector3.new(0,math.pi/2,math.pi/9))
  1051. joint4.C1 = CFrame.new(0,0.7 + (0.3/35*counter),0.2 - (0.2/35*counter)) * CFrame.Angles(0,math.pi/2,0)
  1052. SetWeld(joint5,counter,35, j5,j5a, Vector3.new(0,1,0), Vector3.new(-math.pi/6,0,0))
  1053. end
  1054.  
  1055. if hitz ~= nil then
  1056. bv:remove()
  1057. 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)
  1058. Torsoz.Velocity = NV
  1059. Torsoz.RotVelocity = NV
  1060. local bp = Instance.new("BodyPosition", Torsoz)
  1061. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  1062. bp.position = Torsoz.CFrame.p
  1063. game:service("Debris"):AddItem(bp, 0.16)
  1064. flow.Value = 0
  1065. break
  1066. end
  1067.  
  1068. if GravPoint > - 180 then
  1069. GravPoint = GravPoint - 1.9
  1070. end
  1071. if counter > 200 then
  1072. break
  1073. end
  1074. wait(0.02)
  1075. end
  1076.  
  1077. local bp = Instance.new("BodyPosition")
  1078.  
  1079. local counter2 = counter
  1080. local bgangleplus = 0
  1081.  
  1082. local j1,j1a = GetWeld(joint1)
  1083. local j2,j2a = GetWeld(joint2)
  1084. local j3,j3a = GetWeld(joint3)
  1085. local j4,j4a = GetWeld(joint4)
  1086. local j5,j5a = GetWeld(joint5)
  1087.  
  1088. local landingpos
  1089.  
  1090. while VWallRunning == "BackflipFromFall" do
  1091. counter2 = counter2 + 1
  1092. local hitz, enz = RAY(H.Position+Vector3.new(0,2,0), Vector3.new(0,-4.4,0))
  1093.  
  1094. if counter2 - counter < 13 then
  1095. bgangleplus = bgangleplus - ((math.pi*1.1)/13)
  1096. end
  1097. if counter2 - counter <= 13 then
  1098. 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))
  1099. 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))
  1100. SetWeld(joint3,counter2-counter,13, j3,j3a, Vector3.new(0.52,-0.3,-0.65), Vector3.new(0,math.pi/2,0))
  1101. SetWeld(joint4,counter2-counter,13, j4,j4a, Vector3.new(-0.51,-0.9,-0.05), Vector3.new(0,math.pi/2,0))
  1102. SetWeld(joint5,counter2-counter,13, j5,j5a, Vector3.new(0,0.9,0), Vector3.new(-math.pi/7,0,0))
  1103. end
  1104.  
  1105. dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  1106. --bv.velocity = Vector3.new(0,-2,0)
  1107. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  1108. if VWRLeft == true then
  1109. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  1110. end
  1111. if VWRRight == true then
  1112. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  1113. end
  1114. bg.cframe = CFrame.new(NV, (-towall*30) + Vector3.new(0,GravPoint,0)) * CFrame.Angles((-math.pi/2.4) + bgangleplus,math.pi,0)
  1115.  
  1116. if hitz ~= nil then
  1117. bv:remove()
  1118. landingpos = enz - (towall*1.3)
  1119. if counter2 - counter > 8 then
  1120. bp = Instance.new("BodyPosition", Torsoz)
  1121. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  1122. bp.position = enz+Vector3.new(0,2.4,0) + (-towall*1)
  1123. VWallRunning = "LandingFall"
  1124. else
  1125. Torsoz.CFrame = bg.cframe + (enz+Vector3.new(0,2.3,0))
  1126. Torsoz.Velocity = NV
  1127. Torsoz.RotVelocity = NV
  1128. local bp = Instance.new("BodyPosition", Torsoz)
  1129. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  1130. bp.position = Torsoz.CFrame.p
  1131. game:service("Debris"):AddItem(bp, 0.14)
  1132. flow.Value = 0
  1133. end
  1134. break
  1135. end
  1136.  
  1137. if GravPoint > - 180 then
  1138. GravPoint = GravPoint - 1.9
  1139. end
  1140. if counter2 > 200 then
  1141. break
  1142. end
  1143. wait(0.02)
  1144. end
  1145.  
  1146. if VWallRunning == "LandingFall" then
  1147. print("Landing")
  1148.  
  1149. joint3.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  1150. joint4.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  1151. local j1,j1a = GetWeld(joint1)
  1152. local j2,j2a = GetWeld(joint2)
  1153. local j3,j3a = GetWeld(joint3)
  1154. local j4,j4a = GetWeld(joint4)
  1155. local j5,j5a = GetWeld(joint5)
  1156.  
  1157. local a
  1158. local mesh
  1159. if GravPoint < -70 then
  1160. a = P:Clone()
  1161. a.Parent = Torsoz
  1162. a.Name = "AirLandingEffect"
  1163. a.BrickColor = BrickColor.new("Medium stone grey")
  1164. a.Transparency = 0.3
  1165. a.CFrame = CFrame.new(landingpos+Vector3.new(0,0.4,0))
  1166. mesh = Instance.new("SpecialMesh", a)
  1167. mesh.MeshId = "http://www.roblox.com/asset/?id=20329976"
  1168. mesh.Scale = Vector3.new(0,0,0)
  1169. end
  1170.  
  1171. local bgcf = CFrame.new(NV, Vector3.new(towall.x,0,towall.z))
  1172. bg.cframe = bgcf * CFrame.Angles(-math.pi/7,0,0)
  1173. local bgval = math.pi/7/2
  1174.  
  1175. for i = 1, 6 do
  1176. Hu.PlatformStand = true
  1177. 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))
  1178. 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))
  1179. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.51,-0.3,-0.8), Vector3.new(0,math.pi/2,-math.pi/7))
  1180. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.51,-0.8,-0.7), Vector3.new(0,math.pi/2,-math.pi/3))
  1181. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,0.85,0), Vector3.new(-math.pi/8,0,0))
  1182. bp.position = bp.position + Vector3.new(0,-0.07,0)
  1183. bg.cframe = bgcf * CFrame.Angles((-bgval*2) + (bgval/6*i),0,0)
  1184. Torsoz.CFrame = bg.cframe + bp.position
  1185. if a ~= nil then
  1186. mesh.Scale = mesh.Scale + Vector3.new(1.3,0.35,1.3)
  1187. a.Transparency = 0.3 + (0.7/6*i)
  1188. end
  1189. wait(0.02)
  1190. end
  1191. if a ~= nil then
  1192. a:remove()
  1193. end
  1194. local j1,j1a = GetWeld(joint1)
  1195. local j2,j2a = GetWeld(joint2)
  1196. local j3,j3a = GetWeld(joint3)
  1197. local j4,j4a = GetWeld(joint4)
  1198. local j5,j5a = GetWeld(joint5)
  1199. for i = 1, 6 do
  1200. Hu.PlatformStand = true
  1201. SetWeld(joint1,i,6, j1,j1a, Vector3.new(1.5,0.5,0), Vector3.new(0,0,0))
  1202. SetWeld(joint2,i,6, j2,j2a, Vector3.new(-1.5,0.5,0), Vector3.new(0,0,0))
  1203. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.5,-1,0), Vector3.new(0,math.pi/2,0))
  1204. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.5,-1,0), Vector3.new(0,math.pi/2,0))
  1205. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,1,0), Vector3.new(0,0,0))
  1206. bp.position = bp.position + Vector3.new(0,0.1,0)
  1207. bg.cframe = bgcf * CFrame.Angles(-bgval + (bgval/6*i),0,0)
  1208. Torsoz.CFrame = bg.cframe + bp.position
  1209. wait(0.02)
  1210. end
  1211.  
  1212. bp:remove()
  1213. end
  1214.  
  1215. end
  1216.  
  1217. bv:remove()
  1218. bg:remove()
  1219. VWallRunning = false
  1220. Stand()
  1221. end
  1222. end
  1223.  
  1224. function Slide(pos)
  1225. flow.Value = flow.Value + 6
  1226. Action = "Sliding"
  1227. Sliding = true
  1228. GravPoint = Torsoz.Velocity.y
  1229. local spd = Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude + 10
  1230. local dir = Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).unit
  1231.  
  1232. local bv = Instance.new("BodyVelocity", Torsoz)
  1233. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  1234. bv.velocity = dir*spd
  1235. local bg = Instance.new("BodyGyro", Torsoz)
  1236. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  1237. bg.cframe = CFrame.new(NV, dir) * CFrame.Angles(math.pi/2.2,0.24,0)
  1238.  
  1239. local joint1 = Joint1
  1240. local joint2 = Joint2
  1241. local joint3 = Joint3
  1242. local joint4 = Joint4
  1243. local joint5 = Joint5
  1244. local j1,j1a = GetWeld(joint1)
  1245. local j2,j2a = GetWeld(joint2)
  1246.  
  1247. SetWeld(joint1,1,1, NV,NV, Vector3.new(j1.x,j1.y,j1.z), Vector3.new(j1a.x,math.pi/2,j1a.z))
  1248. joint1.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  1249. SetWeld(joint2,1,1, NV,NV, Vector3.new(j2.x,j2.y,j2.z), Vector3.new(j2a.x,math.pi/2,j2a.z))
  1250. joint2.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  1251.  
  1252. local j1,j1a = GetWeld(joint1)
  1253. local j2,j2a = GetWeld(joint2)
  1254. local j3,j3a = GetWeld(joint3)
  1255. local j4,j4a = GetWeld(joint4)
  1256. local j5,j5a = GetWeld(joint5)
  1257.  
  1258. local count = 0
  1259. local lastpos
  1260.  
  1261. while Sliding == true do
  1262. count = count + 1
  1263. Hu.PlatformStand = true
  1264. local hitz1, enz1 = RAY(Torsoz.Position+Vector3.new(0,0.03,0), dir *2.5)
  1265. local hitz2, enz2 = RAY(Torsoz.Position-Vector3.new(0,0.2,0), dir *2.5)
  1266. local ghitz, genz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  1267. bv.velocity = dir*spd + Vector3.new(0,GravPoint,0)
  1268.  
  1269. if count <= 5 then
  1270. SetWeld(joint1,count,5, j1,j1a, Vector3.new(0.5,-0.8,-0.15), Vector3.new(0,(math.pi/2)+0.1,-0.4))
  1271. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-0.5,-1,0), Vector3.new(0,(math.pi/2)-0.4,0))
  1272. SetWeld(joint3,count,5, j3,j3a, Vector3.new(1.5,0.5,0), Vector3.new(-0.7,-0.24,math.pi/5))
  1273. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-1.5,0.5,0), Vector3.new(-0.1,0,-math.pi/1.5))
  1274. SetWeld(joint5,count,5, j5,j5a, Vector3.new(0,1,0), Vector3.new(-0.5,-0.2,0))
  1275. end
  1276.  
  1277. if (hitz1 ~= nil and hitz1.CanCollide == true) or (hitz2 ~= nil and hitz2.CanCollide == true) then
  1278. bv:remove()
  1279. bg:remove()
  1280. Sliding = "HitObject"
  1281. end
  1282. if ghitz ~= nil then
  1283. GravPoint = 0
  1284. Torsoz.CFrame = CFrame.new(genz, genz+dir) * CFrame.Angles(math.pi/2.2,0.24,0) + Vector3.new(0,0.7,0)
  1285. spd = spd - 0.95
  1286. else
  1287. if GravPoint > -180 then
  1288. GravPoint = GravPoint - 5.6
  1289. end
  1290. spd = spd - 0.36
  1291. end
  1292. if spd < 7 then
  1293. Sliding = false
  1294. end
  1295. wait(0.02)
  1296. end
  1297.  
  1298. if Sliding == false then
  1299. local j1,j1a = GetWeld(joint1)
  1300. local j2,j2a = GetWeld(joint2)
  1301. local j3,j3a = GetWeld(joint3)
  1302. local j4,j4a = GetWeld(joint4)
  1303. local j5,j5a = GetWeld(joint5)
  1304. for i = 1, 4 do
  1305. SetWeld(joint1,i,4, j1,j1a, Vector3.new(0.5,-1,0), Vector3.new(0,math.pi/2,0))
  1306. SetWeld(joint2,i,4, j2,j2a, Vector3.new(-0.5,-1,0), Vector3.new(0,math.pi/2,0))
  1307. SetWeld(joint3,i,4, j3,j3a, Vector3.new(1.5,0.5,0), NV)
  1308. SetWeld(joint4,i,4, j4,j4a, Vector3.new(-1.5,0.5,0), NV)
  1309. SetWeld(joint5,i,4, j5,j5a, Vector3.new(0,1,0), NV)
  1310. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  1311. 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)
  1312. bv.velocity = dir*spd + Vector3.new(0,GravPoint,0)
  1313.  
  1314. if hitz ~= nil then
  1315. GravPoint = 0
  1316. 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)
  1317. spd = spd - 0.95
  1318. else
  1319. if GravPoint > -180 then
  1320. GravPoint = GravPoint - 5.6
  1321. end
  1322. spd = spd - 0.36
  1323. end
  1324. wait(0.02)
  1325. end
  1326. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  1327. Torsoz.CFrame = CFrame.new(enz, enz+dir) + Vector3.new(0,3,0)
  1328. end
  1329. bv:remove()
  1330. bg:remove()
  1331. SlideCooldown = 10
  1332. Stand()
  1333. end
  1334.  
  1335. function KD(key)
  1336. if pause.Value == false then
  1337. if key == string.char(32) then
  1338. Space = true
  1339.  
  1340. local ghitz, genz = RAY(Torsoz.Position, Vector3.new(0,-3.7,0))
  1341. local hitz, enz = RAY(Torsoz.Position+Vector3.new(0,1.1,0), Torsoz.CFrame.lookVector*2.3)
  1342. local righthitz, rightenz
  1343. local lefthitz, leftenz
  1344.  
  1345. if HWallRunning == false then
  1346. righthitz, rightenz = RAY(Torsoz.Position, ((Torsoz.CFrame * CFrame.new(1.5,0,-0.2)).p - Torsoz.CFrame.p).unit*3.9)
  1347. lefthitz, leftenz = RAY(Torsoz.Position, ((Torsoz.CFrame * CFrame.new(-1.5,0,-0.2)).p - Torsoz.CFrame.p).unit*3.9)
  1348.  
  1349. elseif HWallRunning == "Jumping" then
  1350. 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)
  1351. 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)
  1352.  
  1353. end
  1354.  
  1355. 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
  1356. if stamina >= 10 then
  1357. --if Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 12 then
  1358. Dive()
  1359. --end
  1360. end
  1361. end
  1362.  
  1363. if hitz == nil and VWallRunning == "Falling" then
  1364. VWallRunning = "BackflipFromFall"
  1365. end
  1366.  
  1367. if Shift == true and Torsoz.Velocity.y > -50 and Diving == false and DivingCooldown <= 0 then
  1368. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-3.5,0))
  1369.  
  1370. if hitz ~= nil then
  1371. if Action == "Standing" and VWRCooldown == 0 then
  1372. if hitz2 == nil or hitz2.CanCollide == false then
  1373. VWR(hitz, enz)
  1374. end
  1375. end
  1376. end
  1377.  
  1378. if (HWallRunning == false or (HWallRunning == "Jumping" and (HWRLastPart ~= righthitz or HWRLastPart ~= lefthitz))) and HWRCooldown == 0 and VWallRunning == false then
  1379.  
  1380. 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
  1381. if hitz2 == nil or hitz2.CanCollide == false then
  1382. local right = (rightenz - Torsoz.Position).magnitude
  1383. local left = (leftenz - Torsoz.Position).magnitude
  1384. if right < left then
  1385. if HWallRunning == "Jumping" and HWRLastPart ~= righthitz then
  1386. HWallRunning = false
  1387. while Standing == false do
  1388. wait(0.01)
  1389. end
  1390. print("2nd Right Activated!")
  1391. HWallRun(righthitz, rightenz, -math.pi/2)
  1392. else
  1393. if hitz == nil then
  1394. print("Right Activated")
  1395. HWallRun(righthitz, rightenz, -math.pi/2)
  1396. end
  1397. end
  1398. elseif left < right then
  1399. if HWallRunning == "Jumping" and HWRLastPart ~= lefthitz then
  1400. HWallRunning = false
  1401. while Standing == false do
  1402. wait(0.01)
  1403. end
  1404. print("2nd Left Activated!")
  1405. HWallRun(lefthitz, leftenz, math.pi/2)
  1406. else
  1407. if hitz == nil then
  1408. print("Left Activated")
  1409. HWallRun(lefthitz, leftenz, math.pi/2)
  1410. end
  1411. end
  1412. end
  1413. end
  1414. end
  1415. end
  1416.  
  1417. end
  1418.  
  1419. if HWallRunning == true then
  1420. HWallRunning = "Jumping"
  1421. Action = "HWRJumping"
  1422. end
  1423.  
  1424. elseif key == string.char(48) then
  1425. Shift = true
  1426. elseif key == string.char(50) then
  1427. if Action == "Standing" then
  1428. Sit()
  1429. elseif HWallRunning == true then
  1430. HWRGravDrop = true
  1431. end
  1432. elseif key == string.char(52) then
  1433. 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
  1434. print("Sliding")
  1435. Slide()
  1436. end
  1437. elseif key == "a" then
  1438. VWRLeft = true
  1439. elseif key == "d" then
  1440. VWRRight = true
  1441. end
  1442. end
  1443. end
  1444.  
  1445. function KU(key)
  1446. if key == string.char(32) then
  1447. Space = false
  1448. elseif key == string.char(48) then
  1449. Shift = false
  1450. elseif key == string.char(50) then
  1451. if Action == "Sitting" then
  1452. Stand()
  1453. end
  1454. elseif key == string.char(52) then
  1455. Sliding = false
  1456. elseif key == "a" then
  1457. VWRLeft = false
  1458. elseif key == "d" then
  1459. VWRRight = false
  1460. end
  1461. end
  1462.  
  1463. mouse.KeyDown:connect(function(key) KD(key) end)
  1464. mouse.KeyUp:connect(function(key) KU(key) end)
  1465.  
  1466. Joint1 = Instance.new("Snap", Torsoz)
  1467. GetWeld(Joint1)
  1468. Joint2 = Instance.new("Snap", Torsoz)
  1469. GetWeld(Joint2)
  1470. Joint3 = Instance.new("Snap", Torsoz)
  1471. GetWeld(Joint3)
  1472. Joint4 = Instance.new("Snap", Torsoz)
  1473. GetWeld(Joint4)
  1474. Joint5 = Instance.new("Snap", Torsoz)
  1475. GetWeld(Joint5)
  1476. Stand()
  1477.  
  1478. local animatebg = Instance.new("BodyGyro")
  1479. animatebg.D = 100
  1480. local GravAction = "Idle"
  1481. local PrevGravAction = GravAction
  1482.  
  1483. local prevrapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  1484. local prevlapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  1485. local hue = 0
  1486. local recyclecount = 0
  1487. local tickoffset = tick()
  1488. local fadetab = {}
  1489. local fadetab2 = {}
  1490. local animatebgcount = 0
  1491.  
  1492. for i = 1, 13 do
  1493. local p = P:Clone()
  1494. p.Name = "Part"..i
  1495. local mesh = Instance.new("SpecialMesh", p)
  1496. mesh.MeshId = "http://www.roblox.com/Asset/?id=9856898"
  1497. mesh.TextureId = "http://www.roblox.com/Asset/?id=48358980"
  1498. table.insert(fadetab, {p, mesh})
  1499. end
  1500. for i = 1, 13 do
  1501. local p = P:Clone()
  1502. p.Name = "Part"..i
  1503. local mesh = Instance.new("SpecialMesh", p)
  1504. mesh.MeshId = "http://www.roblox.com/Asset/?id=9856898"
  1505. mesh.TextureId = "http://www.roblox.com/Asset/?id=48358980"
  1506. table.insert(fadetab2, {p, mesh})
  1507. end
  1508.  
  1509. game:service("RunService").Stepped:connect(function()
  1510. GravAction = "Idle"
  1511. hue = hue + 3
  1512. hue = hue % 360
  1513.  
  1514. ------------- anim angle changing --------
  1515. if animangle > math.pi then
  1516. animplus = false
  1517. elseif animangle < -math.pi then
  1518. animplus = true
  1519. end
  1520. if animplus == true then
  1521. animangle = animangle + animspeed
  1522. elseif animplus == false then
  1523. animangle = animangle - animspeed
  1524. end
  1525.  
  1526. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-3.9,0))
  1527. if Shift == true then
  1528. Hu.WalkSpeed = sprint
  1529. else
  1530. Hu.WalkSpeed = 16
  1531. end
  1532. if (FOV >= 70 and FOV < 74) and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 25 then
  1533. FOV = FOV + 1
  1534. elseif (FOV <= 74 and FOV > 70) and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude < 20 then
  1535. FOV = FOV - 1
  1536. end
  1537. if pause.Value == true then
  1538. Hu.WalkSpeed = 0
  1539. end
  1540. if Sitting == true then
  1541. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-2.2,0))
  1542. Hu.PlatformStand = true
  1543. if hitz2 == nil then
  1544. Stand()
  1545. end
  1546. end
  1547. if Diving == true then
  1548. Hu.PlatformStand = true
  1549. DivingBV.velocity = Vector3.new(DivingDir.x*(sprint+2),GravPoint,DivingDir.z*(sprint+2))
  1550. DivingBG.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+DivingBV.velocity) * CFrame.Angles(-math.pi/2,0,0)
  1551.  
  1552. if GravPoint > -180 then
  1553. GravPoint = GravPoint - 2
  1554. end
  1555. end
  1556. if DivingCooldown > 0 then
  1557. DivingCooldown = DivingCooldown - 1
  1558. end
  1559. if HWallRunning == true then
  1560. if HWRGravDrop == false then
  1561. GravPoint = GravPoint - 0.4
  1562. else
  1563. GravPoint = GravPoint - 2
  1564. end
  1565. elseif HWallRunning == "Jumping" then
  1566. GravPoint = GravPoint - 1.7
  1567. end
  1568. ----------------------------- stamina ----------------------------------------
  1569. if Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude > 18 and Action == "Standing" and Shift == true then
  1570. if stamina > 0 then
  1571. stamina = stamina - 0.5
  1572. if stamina < 0 then
  1573. Shift = false
  1574. stamina = 0
  1575. end
  1576. else
  1577. Shift = false
  1578. stamina = 0
  1579. end
  1580. if Action == "Standing" then
  1581. animspeed = 0.85
  1582. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/4.85,0,0))
  1583. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/4.85,0,0))
  1584. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/3.5,0,0))
  1585. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/3.5,0,0))
  1586. end
  1587. elseif Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude > 12 and Action ~= "Sliding" then
  1588. if stamina < maxstamina then
  1589. stamina = stamina + 0.5
  1590. if stamina > maxstamina then
  1591. stamina = maxstamina
  1592. end
  1593. else
  1594. stamina = maxstamina
  1595. end
  1596. if Action == "Standing" then
  1597. animspeed = 0.65
  1598. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/7,0,0))
  1599. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/7,0,0))
  1600. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/5,0,0))
  1601. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/5,0,0))
  1602. end
  1603. elseif Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude < 2 then
  1604. animspeed = 0.1
  1605. if Action == "Standing" then
  1606. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/38,0,0))
  1607. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/38,0,0))
  1608. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/30,0,0))
  1609. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/30,0,0))
  1610. end
  1611. if stamina < maxstamina then
  1612. if Sitting == false then
  1613. stamina = stamina + 0.65
  1614. else
  1615. stamina = stamina + 1.02
  1616. end
  1617. if stamina > maxstamina then
  1618. stamina = maxstamina
  1619. end
  1620. else
  1621. stamina = maxstamina
  1622. end
  1623. end
  1624.  
  1625. if hitz == nil then
  1626. if Torsoz.Velocity.y > 1 or (Torsoz.Velocity.y < -1 and Torsoz.Velocity.y > -90) then
  1627. if Action == "Standing" then
  1628. GravAction = "Rising"
  1629. animspeed = 0.1
  1630. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/38,0,0))
  1631. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/38,0,0))
  1632. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new((math.pi-0.2)+(animangle/30),0,0))
  1633. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new((math.pi-0.2)+(-animangle/30),0,0))
  1634. if animatebg.Parent ~= nil then
  1635. animatebg.Parent = Torsoz
  1636. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  1637. local lokvec = Torsoz.CFrame.lookVector*100
  1638. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z))
  1639. animatebg.Parent = nil
  1640. end
  1641. end
  1642. end
  1643. end
  1644.  
  1645. if hitz == nil then
  1646. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-6,0))
  1647. if hitz2 == nil then
  1648. if Torsoz.Velocity.y < -90 then
  1649. if Action == "Standing" then
  1650. GravAction = "Falling"
  1651. animspeed = 1.1
  1652. animatebg.Parent = Torsoz
  1653. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  1654. local lokvec = Torsoz.CFrame.lookVector*100
  1655. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z)) * CFrame.Angles(-math.pi/11,animangle/70,0)
  1656. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.45,-0.8,0), Vector3.new((animangle/27)-0.3,0,0.18))
  1657. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.45,-0.8,0), Vector3.new((-animangle/27)-0.3,0,-0.18))
  1658. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.4,0.5,0), Vector3.new((math.pi+0.2)+(animangle/26),0,0.18))
  1659. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.4,0.5,0), Vector3.new((math.pi+0.2)+(-animangle/26),0,-0.18))
  1660. end
  1661. end
  1662. elseif hitz2.CanCollide == true then
  1663. if animatebg.Parent ~= nil then
  1664. animatebg.Parent = Torsoz
  1665. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  1666. local lokvec = Torsoz.CFrame.lookVector*100
  1667. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z))
  1668. animatebg.Parent = nil
  1669. end
  1670. end
  1671. end
  1672.  
  1673. if GravAction == "Idle" and animatebg.Parent ~= nil then
  1674. animatebg.Parent = nil
  1675. end
  1676.  
  1677. if math.abs(tickoffset - tick()) > 0.05 then
  1678. tickoffset = tick()
  1679. local flowcolor = HSV(hue, 0.7,1)
  1680. recyclecount = (recyclecount % #fadetab) + 1
  1681. if flow.Value > 25 then
  1682. local lapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  1683. local rapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  1684. local p = fadetab[recyclecount]
  1685. p[1].Parent = m
  1686. p[1].CFrame = CFrame.new((lapos+prevlapos)/2, lapos)
  1687. p[2].Scale = Vector3.new(0.5,0.5,(lapos-prevlapos).magnitude*2)
  1688. p[2].VertexColor = Vector3.new(flowcolor.r,flowcolor.g,flowcolor.b)
  1689. p[1].Transparency = math.abs((flow.Value/120) - 0.8)
  1690. p[1].Transparency = p[1].Transparency + (1/#fadetab)
  1691. local p = fadetab2[recyclecount]
  1692. p[1].Parent = m
  1693. p[1].CFrame = CFrame.new((rapos+prevrapos)/2, rapos)
  1694. p[2].Scale = Vector3.new(0.5,0.5,(rapos-prevrapos).magnitude*2)
  1695. p[2].VertexColor = Vector3.new(flowcolor.r,flowcolor.g,flowcolor.b)
  1696. p[1].Transparency = math.abs((flow.Value/120) - 0.8)
  1697. p[1].Transparency = p[1].Transparency + (1/#fadetab)
  1698. end
  1699.  
  1700. for i, v in pairs(fadetab) do
  1701. if v[1].Transparency < 0.9 then
  1702. v[1].Transparency = v[1].Transparency + (1/#fadetab)
  1703. fadetab2[i][1].Transparency = fadetab2[i][1].Transparency + (1/#fadetab)
  1704. elseif v[1].Transparency ~= 1 then
  1705. v[1].Transparency = 1
  1706. v[1].Position = Vector3.new(50000,0,0)
  1707. fadetab2[i][1].Transparency = 1
  1708. fadetab2[i][1].Position = Vector3.new(50000,0,0)
  1709. end
  1710. end
  1711.  
  1712. prevrapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  1713. prevlapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  1714. end
  1715.  
  1716. if flow.Value > 140 then
  1717. if char.Parent ~= nil then
  1718. char:remove()
  1719. end
  1720. end
  1721.  
  1722. if flowcooldown > 0 then
  1723. flowcooldown = flowcooldown - 1
  1724. end
  1725. if HWRCooldown > 0 then
  1726. HWRCooldown = HWRCooldown - 1
  1727. end
  1728. if VWRCooldown > 0 then
  1729. if hitz ~= nil and VWRCooldown > 0 then
  1730. VWRCooldown = VWRCooldown - 1
  1731. end
  1732. end
  1733. if SlideCooldown > 0 then
  1734. SlideCooldown = SlideCooldown - 1
  1735. end
  1736.  
  1737. if Action == "HWallRunning" or Action == "VWallRunning" then
  1738. flow.Value = flow.Value + 0.24
  1739. if flow.Value > 100 then
  1740. flow.Value = 100
  1741. end
  1742. flowcooldown = 40
  1743. elseif Action == "Diving" then
  1744. flowcooldown = 30
  1745. elseif Action == "Sliding" then
  1746. flowcooldown = 15
  1747. elseif Action == "Standing" or Action == "Sitting" then
  1748. if flow.Value > 0 and flowcooldown <= 0 then
  1749. flow.Value = flow.Value - 0.37
  1750. if flow.Value < 0 then
  1751. flow.Value = 0
  1752. end
  1753. end
  1754. end
  1755.  
  1756. cam.FieldOfView = FOV
  1757. prevanimbgcount = animatebgcount
  1758. sprint = defsprint + ((flow.Value/100)*2.4)
  1759. PrevGravAction = GravAction
  1760. Calculate()
  1761. end)
  1762.  
  1763.  
  1764.  
  1765. local player = owner
  1766. local mouse = player:GetMouse()
  1767. local cam = workspace.CurrentCamera
  1768. local char = player.Character
  1769. local Torsoz = char:findFirstChild("Torso")
  1770. local RA = char:findFirstChild("Right Arm")
  1771. local LA = char:findFirstChild("Left Arm")
  1772. local RL = char:findFirstChild("Right Leg")
  1773. local LL = char:findFirstChild("Left Leg")
  1774. local H = char:findFirstChild("Head")
  1775. local Hu = char:findFirstChild("Humanoid")
  1776. local RS = Torsoz:findFirstChild("Right Shoulder")
  1777. local LS = Torsoz:findFirstChild("Left Shoulder")
  1778. local RH = Torsoz:findFirstChild("Right Hip")
  1779. local LH = Torsoz:findFirstChild("Left Hip")
  1780. local N = Torsoz:findFirstChild("Neck")
  1781. local NV = Vector3.new(0,0,0)
  1782. local FOV = 70
  1783. local Shift, Space, Sitting = false,false,false
  1784. local GravPoint = 0
  1785. local Diving = false
  1786. local DivingCooldown = 0
  1787. local DivingDir = NV
  1788. local DivingCF = CFrame.new(0,0,0)
  1789. local DivingBG, DivingBV
  1790. local HWallRunning = false
  1791. local HWRGravDrop = false
  1792. local HWRLastPart
  1793. local HWRCooldown = 0
  1794. local HWRDir
  1795. local VWallRunning = false
  1796. local VWRLastPart
  1797. local VWRCooldown = 0
  1798. local VWRLeft,VWRRight = false,false
  1799. local Sliding = false
  1800. local SlideCooldown = 0
  1801. local Standing = true
  1802. local Action = "Standing"
  1803. local animplus = true
  1804. local animspeed = 0
  1805. local animangle = 0.01
  1806. local Joint1, Joint2, Joint3, Joint4, Joint5
  1807.  
  1808. for i, v in pairs(char:children()) do
  1809. 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
  1810. v:remove()
  1811. end
  1812. end
  1813.  
  1814. local loadids = {112474909, 112474911, 112474909}
  1815.  
  1816. local stamina = 100
  1817. local maxstamina = 100
  1818. local defsprint = 28
  1819. local sprint = defsprint
  1820.  
  1821. local pause = Instance.new("BoolValue", char)
  1822. pause.Name = "Pause"
  1823. pause.Value = false
  1824. local flow = Instance.new("NumberValue", char)
  1825. flow.Name = "Flow"
  1826. flow.Value = 0
  1827. local flowcooldown = 0
  1828.  
  1829. local m = Instance.new("Model", char)
  1830. m.Name = "FlowChainPartz"
  1831.  
  1832. local P = Instance.new("Part")
  1833. P.Name = "TrailPart"
  1834. P.formFactor = "Custom"
  1835. P.Size = Vector3.new(0.2,0.2,0.2)
  1836. P.Locked = true
  1837. P.Anchored = true
  1838. P.CanCollide = false
  1839. P.TopSurface = 0
  1840. P.BottomSurface = 0
  1841.  
  1842. script.Name = "ParkourSkrip"
  1843.  
  1844. local hue = 0
  1845.  
  1846. function HSV(H,S,V)
  1847. H = H % 360
  1848. local C = V * S
  1849. local H2 = H/60
  1850. local X = C * (1 - math.abs((H2 %2) -1))
  1851. local color = Color3.new(0,0,0)
  1852. if H2 <= 0 then
  1853. color = Color3.new(C,0,0)
  1854. elseif 0 <= H2 and H2 <= 1 then
  1855. color = Color3.new(C,X,0)
  1856. elseif 1 <= H2 and H2 <= 2 then
  1857. color = Color3.new(X,C,0)
  1858. elseif 2 <= H2 and H2 <= 3 then
  1859. color = Color3.new(0,C,X)
  1860. elseif 3 <= H2 and H2 <= 4 then
  1861. color = Color3.new(0,X,C)
  1862. elseif 4 <= H2 and H2 <= 5 then
  1863. color = Color3.new(X,0,C)
  1864. elseif 5 <= H2 and H2 <= 6 then
  1865. color = Color3.new(C,0,X)
  1866. end
  1867. local m = V - C
  1868. return Color3.new(color.r + m, color.g + m, color.b + m)
  1869. end
  1870.  
  1871. function GetWeld(weld)
  1872. if weld:findFirstChild("XAngle") == nil then
  1873. local a = Instance.new("NumberValue", weld)
  1874. a.Name = "XAngle"
  1875. end
  1876. if weld:findFirstChild("YAngle") == nil then
  1877. local a = Instance.new("NumberValue", weld)
  1878. a.Name = "YAngle"
  1879. end
  1880. if weld:findFirstChild("ZAngle") == nil then
  1881. local a = Instance.new("NumberValue", weld)
  1882. a.Name = "ZAngle"
  1883. end
  1884. return weld.C0.p, Vector3.new(weld.XAngle.Value, weld.YAngle.Value, weld.ZAngle.Value)
  1885. end
  1886.  
  1887. function SetWeld(weld, i, loops, origpos,origangle, nextpos,nextangle)
  1888. if weld:findFirstChild("XAngle") == nil then
  1889. local a = Instance.new("NumberValue", weld)
  1890. a.Name = "XAngle"
  1891. end
  1892. if weld:findFirstChild("YAngle") == nil then
  1893. local a = Instance.new("NumberValue", weld)
  1894. a.Name = "YAngle"
  1895. end
  1896. if weld:findFirstChild("ZAngle") == nil then
  1897. local a = Instance.new("NumberValue", weld)
  1898. a.Name = "ZAngle"
  1899. end
  1900.  
  1901. local tox,toy,toz = 0,0,0
  1902. if origangle.x > nextangle.x then
  1903. tox = -math.abs(origangle.x - nextangle.x) /loops*i
  1904. else
  1905. tox = math.abs(origangle.x - nextangle.x) /loops*i
  1906. end
  1907. if origangle.y > nextangle.y then
  1908. toy = -math.abs(origangle.y - nextangle.y) /loops*i
  1909. else
  1910. toy = math.abs(origangle.y - nextangle.y) /loops*i
  1911. end
  1912. if origangle.z > nextangle.z then
  1913. toz = -math.abs(origangle.z - nextangle.z) /loops*i
  1914. else
  1915. toz = math.abs(origangle.z - nextangle.z) /loops*i
  1916. end
  1917.  
  1918. local tox2,toy2,toz2 = 0,0,0
  1919. if origpos.x > nextpos.x then
  1920. tox2 = -math.abs(origpos.x - nextpos.x) /loops*i
  1921. else
  1922. tox2 = math.abs(origpos.x - nextpos.x) /loops*i
  1923. end
  1924. if origpos.y > nextpos.y then
  1925. toy2 = -math.abs(origpos.y - nextpos.y) /loops*i
  1926. else
  1927. toy2 = math.abs(origpos.y - nextpos.y) /loops*i
  1928. end
  1929. if origpos.z > nextpos.z then
  1930. toz2 = -math.abs(origpos.z - nextpos.z) /loops*i
  1931. else
  1932. toz2 = math.abs(origpos.z - nextpos.z) /loops*i
  1933. end
  1934.  
  1935. weld.XAngle.Value = origangle.x + tox
  1936. weld.YAngle.Value = origangle.y + toy
  1937. weld.ZAngle.Value = origangle.z + toz
  1938. weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz)
  1939. end
  1940.  
  1941. function LoadTextures()
  1942. local pls = game:service("ContentProvider")
  1943. for i, v in pairs(loadids) do
  1944. pls:Preload("http://www.roblox.com/asset/?id="..v)
  1945. wait(0.04)
  1946. end
  1947. end
  1948. LoadTextures()
  1949.  
  1950. function CreateGui()
  1951. for i, v in pairs(player.PlayerGui:children()) do
  1952. if v.className == "ScreenGui" and v.Name == "staminaGui" then
  1953. v:remove()
  1954. end
  1955. end
  1956. local g = Instance.new("ScreenGui", player.PlayerGui)
  1957. g.Name = "staminaGui"
  1958.  
  1959. local c = Instance.new("Frame", g)
  1960. c.Visible = false
  1961. c.Size = UDim2.new(0,86,0,320)
  1962. c.BackgroundTransparency = 1
  1963. c.Position = UDim2.new(1,-96,0.5,-160)
  1964. c.Name = "Container"
  1965.  
  1966. local t = Instance.new("TextLabel", c)
  1967. t.Size = UDim2.new(0,0,-0.1,0)
  1968. t.Position = UDim2.new(0.3,0,0.5,0)
  1969. t.TextXAlignment = "Right"
  1970. t.Font = "ArialBold"
  1971. t.TextTransparency = 0.1
  1972. t.TextColor3 = Color3.new(0,0.6,0.8)
  1973. t.TextStrokeColor3 = Color3.new(0,0.2,0.8)
  1974. t.TextStrokeTransparency = 0.3
  1975. t.FontSize = 6
  1976. t.BackgroundTransparency = 1
  1977. local t2 = t:Clone()
  1978. t2.Parent = c
  1979. t2.Size = UDim2.new(0,0,0.1,0)
  1980. local l = t:Clone()
  1981. l.Parent = c
  1982. l.Size = UDim2.new(0,0,0,0)
  1983. l.Text = "-----"
  1984.  
  1985. local f1 = Instance.new("Frame", c)
  1986. f1.Name = "Backing"
  1987. f1.ClipsDescendants = true
  1988. f1.Size = UDim2.new(1,0,0,0)
  1989. f1.BackgroundColor3 = Color3.new(0.8,0,0)
  1990. f1.BackgroundTransparency = 1
  1991. local f1img = Instance.new("ImageLabel", f1)
  1992. f1img.BackgroundTransparency = 1
  1993. f1img.Image = "http://www.roblox.com/asset/?id=112474909"
  1994. f1img.Size = UDim2.new(1,0,0,c.Size.Y.Offset)
  1995.  
  1996. local f2 = Instance.new("Frame", c)
  1997. f2.Name = "Overlay"
  1998. f2.ClipsDescendants = true
  1999. f2.Size = UDim2.new(1,0,1,0)
  2000. f2.BackgroundColor3 = Color3.new(0,0,0.8)
  2001. f2.BackgroundTransparency = 1
  2002. local f2img = Instance.new("ImageLabel", f2)
  2003. f2img.BackgroundTransparency = 1
  2004. f2img.Image = "http://www.roblox.com/asset/?id=112474911"
  2005. f2img.Size = UDim2.new(1,0,0,c.Size.Y.Offset)
  2006.  
  2007. function Calculate()
  2008. local ysize = c.Size.Y.Offset
  2009. local per = (stamina/maxstamina) * c.Size.Y.Offset
  2010. local rem = (-(stamina/maxstamina-1)) * c.Size.Y.Offset
  2011. f1.Size = UDim2.new(1,0,0,rem)
  2012. f2.Size = UDim2.new(1,0,0,per)
  2013. f2.Position = UDim2.new(0,0,0,rem)
  2014. f2img.Position = UDim2.new(0,0,0,-rem)
  2015. t.Text = math.floor(stamina)
  2016. t2.Text = maxstamina
  2017. end
  2018. Calculate()
  2019.  
  2020. wait(0.01)
  2021. c.Visible = true
  2022. end
  2023. CreateGui()
  2024.  
  2025. player.CharacterAdded:connect(function()
  2026. char = player.Character
  2027. Torsoz = char:findFirstChild("Torso")
  2028. RA = char:findFirstChild("Right Arm")
  2029. LA = char:findFirstChild("Left Arm")
  2030. RL = char:findFirstChild("Right Leg")
  2031. LL = char:findFirstChild("Left Leg")
  2032. H = char:findFirstChild("Head")
  2033. Hu = char:findFirstChild("Humanoid")
  2034. RS = Torsoz:findFirstChild("Right Shoulder")
  2035. LS = Torsoz:findFirstChild("Left Shoulder")
  2036. RH = Torsoz:findFirstChild("Right Hip")
  2037. LH = Torsoz:findFirstChild("Left Hip")
  2038. N = Torsoz:findFirstChild("Neck")
  2039. stamina = maxstamina
  2040. CreateGui()
  2041. end)
  2042.  
  2043. function RAY(pos, dir, startpos, endpos, distleft, collidedlist)
  2044. collidedlist = collidedlist or {char}
  2045. startpos = startpos or pos
  2046. distleft = distleft or dir.unit * dir.magnitude
  2047. endpos = endpos or pos + distleft
  2048. local ray = Ray.new(pos, distleft)
  2049. local hitz,enz = workspace:FindPartOnRayWithIgnoreList(ray, collidedlist)
  2050. --[[
  2051. local p = P:Clone()
  2052. p.Parent = char
  2053. p.Size = Vector3.new(0.4,0.4,0.4)
  2054. p.BrickColor = BrickColor.new("Lime green")
  2055. p.CanCollide = false
  2056. p.CFrame = CFrame.new(enz)
  2057. p.Transparency = 0.3
  2058. ]]
  2059. if hitz ~= nil then
  2060. if hitz.CanCollide == false then
  2061. table.insert(collidedlist, hitz)
  2062. local newpos = enz
  2063. local newdistleft = distleft - (dir.unit * (pos - newpos).magnitude)
  2064. if newdistleft ~= NV then
  2065. return RAY(newpos-(dir*0.01), dir, startpos, endpos, newdistleft+(dir*0.01), collidedlist)
  2066. end
  2067. end
  2068. end
  2069.  
  2070. return hitz, enz, ray
  2071. end
  2072.  
  2073. function Sit()
  2074. Standing = false
  2075. local hitz,enz = RAY(Torsoz.Position, Vector3.new(0,-4.1,0))
  2076. local tordir = Vector3.new(Torsoz.CFrame.lookVector.x,0,Torsoz.CFrame.lookVector.z)
  2077. if (hitz ~= nil and hitz.CanCollide == true) then
  2078. 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)
  2079. local hitz2,enz2 = RAY(enz+Vector3.new(0,2.25,0), tordir*-2.2)
  2080. Hu.PlatformStand = true
  2081. Torsoz.CFrame = cf
  2082. local bp = Instance.new("BodyPosition", Torsoz)
  2083. bp.Name = "StaminaBodyObject"
  2084. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  2085. bp.D = 100
  2086. bp.position = cf.p
  2087. local bg = Instance.new("BodyGyro", Torsoz)
  2088. bg.Name = "StaminaBodyObject"
  2089. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  2090. bg.cframe = cf
  2091. bg.D = 100
  2092. 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))
  2093. 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))
  2094.  
  2095. if hitz2 ~= nil and hitz2.CanCollide == true then
  2096. 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)
  2097. 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)
  2098. Joint5.C0 = CFrame.new(0,1,0) * CFrame.Angles(-math.pi/8.8,0,0)
  2099. else
  2100. 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))
  2101. 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))
  2102. SetWeld(Joint5,1,1, NV,NV, Vector3.new(0,1,0), Vector3.new(-math.pi/12,0,0))
  2103. end
  2104.  
  2105. Sitting = true
  2106. Action = "Sitting"
  2107. end
  2108. end
  2109.  
  2110.  
  2111. function Stand()
  2112. Hu.PlatformStand = false
  2113. if Sitting == true then
  2114. local tordir = Torsoz.Position + (Torsoz.CFrame.lookVector*10000)
  2115. local cf = CFrame.new(Torsoz.Position + Vector3.new(0,1.8,0), Vector3.new(tordir.x,Torsoz.Position.y,tordir.z))
  2116. Torsoz.CFrame = cf
  2117. end
  2118. for i, v in pairs(Torsoz:children()) do
  2119. if v.Name == "StaminaBodyObject" then
  2120. v:remove()
  2121. end
  2122. end
  2123. RH.Part0 = nil
  2124. LH.Part0 = nil
  2125. RS.Part0 = nil
  2126. LS.Part0 = nil
  2127. Joint1.Part0 = Torsoz
  2128. Joint1.Part1 = RL
  2129. Joint1.C0 = CFrame.new(0.5,-1,0)
  2130. Joint1.C1 = CFrame.new(0,1,0)
  2131. Joint2.Part0 = Torsoz
  2132. Joint2.Part1 = LL
  2133. Joint2.C0 = CFrame.new(-0.5,-1,0)
  2134. Joint2.C1 = CFrame.new(0,1,0)
  2135. Joint3.Part0 = Torsoz
  2136. Joint3.Part1 = RA
  2137. Joint3.C0 = CFrame.new(1.5,0.5,0)
  2138. Joint3.C1 = CFrame.new(0,0.5,0)
  2139. Joint4.Part0 = Torsoz
  2140. Joint4.Part1 = LA
  2141. Joint4.C0 = CFrame.new(-1.5,0.5,0)
  2142. Joint4.C1 = CFrame.new(0,0.5,0)
  2143. Joint5.Part0 = Torsoz
  2144. Joint5.Part1 = H
  2145. Joint5.C0 = CFrame.new(0,1,0)
  2146. Joint5.C1 = CFrame.new(0,-0.5,0)
  2147. Sitting = false
  2148. Diving = false
  2149. Standing = true
  2150. Action = "Standing"
  2151. end
  2152.  
  2153. --------------------------------------- Dive ----------------------------------
  2154.  
  2155. function Dive()
  2156. stamina = stamina - 10
  2157. flow.Value = flow.Value + 10
  2158. if flow.Value > 100 then
  2159. flow.Value = 100
  2160. end
  2161. Standing = false
  2162. local dir = Vector3.new(Torsoz.CFrame.lookVector.x,0,Torsoz.CFrame.lookVector.z)
  2163. GravPoint = 18
  2164. DivingDir = dir
  2165. local cf = CFrame.new(Torsoz.Position, dir+Vector3.new(0,Torsoz.Position.y,0))
  2166. DivingCF = cf
  2167. DivingDir = dir
  2168. Hu.PlatformStand = true
  2169. local bv = Instance.new("BodyVelocity", Torsoz)
  2170. bv.Name = "StaminaBodyObject"
  2171. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  2172. bv.velocity = Vector3.new(DivingDir.x*24,GravPoint,DivingDir.z*24)
  2173. DivingBV = bv
  2174. local bg = Instance.new("BodyGyro", Torsoz)
  2175. bg.Name = "StaminaBodyObject"
  2176. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  2177. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+bv.velocity) * CFrame.Angles(-math.pi/2,0,0)
  2178. bg.D = 100
  2179. DivingBG = bg
  2180.  
  2181. local joint = Joint3
  2182. joint.C1 = CFrame.new(0,0.5,0)
  2183. local joint2 = Joint4
  2184. joint2.C1 = CFrame.new(0,0.5,0)
  2185. local joint3 = Joint1
  2186. joint3.C1 = CFrame.new(0,1,0)
  2187. local joint4 = Joint2
  2188. joint4.C1 = CFrame.new(0,1,0)
  2189.  
  2190. local joint5 = Joint5
  2191.  
  2192. Diving = true
  2193. Action = "Diving"
  2194.  
  2195. for i = 1, 8 do
  2196. 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))
  2197. 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))
  2198. 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))
  2199. 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))
  2200. SetWeld(joint5,i,8, Vector3.new(0,1,0), NV, Vector3.new(0,1,0), Vector3.new(0.45,0,0))
  2201. wait(0.025)
  2202. end
  2203.  
  2204. local counter = 0
  2205. while Diving == true do
  2206. counter = counter + 1
  2207. bg.Parent = Torsoz
  2208. local hitz, enz = RAY(Torsoz.Position, bv.velocity.unit*4.6)
  2209. if hitz ~= nil and hitz.CanCollide == true then
  2210. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-4,0))
  2211. if hitz2 ~= nil then
  2212. Diving = "Rolling"
  2213. Action = "DiveRolling"
  2214. else
  2215. Torsoz.CFrame = Torsoz.CFrame * CFrame.new(0,-0.3,0)
  2216. Torsoz.Velocity = NV
  2217. flow.Value = 0
  2218. break
  2219. end
  2220. end
  2221. if counter > 190 then
  2222. break
  2223. end
  2224. wait(0.02)
  2225. end
  2226.  
  2227. bv.velocity = (dir*20) + Vector3.new(0,-0.5,0)
  2228.  
  2229. local bgcf = bg.cframe
  2230. local haslanded = false
  2231. local count = 0
  2232.  
  2233. while haslanded == false do
  2234. bg.cframe = bgcf * CFrame.Angles(-0.3*count,0,0)
  2235. local hitz, enz = RAY(Torsoz.Position, ((Torsoz.CFrame*CFrame.new(0,-1,0)).p - Torsoz.CFrame.p).unit*1.6)
  2236. if hitz ~= nil and hitz.CanCollide == true then
  2237. haslanded = true
  2238. end
  2239. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-3.8,0))
  2240. if hitz2 == nil then
  2241. Torsoz.Velocity = NV
  2242. break
  2243. elseif haslanded == true then
  2244. local bp = Instance.new("BodyPosition", Torsoz)
  2245. bp.Name = "StaminaJumpFix"
  2246. bp.maxForce = Vector3.new(0,1/0,0)
  2247. bp.P = 7000
  2248. bp.position = enz2 + Vector3.new(0,2.8,0)
  2249. game:service("Debris"):AddItem(bp, 0.3)
  2250. else
  2251. bv.velocity = (dir*20) + Vector3.new(0,-(Torsoz.Position - enz2).magnitude*3,0)
  2252.  
  2253. end
  2254. count = count + 1
  2255. if count <= 6 then
  2256. local i = count
  2257. local j1,j1a = GetWeld(joint)
  2258. local j2,j2a = GetWeld(joint2)
  2259. local j3,j3a = GetWeld(joint3)
  2260. local j4,j4a = GetWeld(joint4)
  2261. local j5,j5a = GetWeld(joint5)
  2262. 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))
  2263. 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))
  2264. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.51,0.4,-0.6), Vector3.new(-0.1,0,0.05))
  2265. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.51,0.4,-0.6), Vector3.new(-0.1,0,-0.05))
  2266. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,1,0), Vector3.new(-0.4,0,0))
  2267. elseif count >= 50 then
  2268. break
  2269. end
  2270. wait(0.02)
  2271. end
  2272.  
  2273. Torsoz.Velocity = NV
  2274.  
  2275. Stand()
  2276. DivingCooldown = 9
  2277. end
  2278.  
  2279. function FindSurface(part, position)
  2280. local obj = part.CFrame:pointToObjectSpace(position)
  2281. local siz = part.Size/2
  2282. for i,v in pairs(Enum.NormalId:GetEnumItems()) do
  2283. local vec = Vector3.FromNormalId(v)
  2284. local wvec = part.CFrame:vectorToWorldSpace(vec)
  2285. local vz = (obj)/(siz*vec)
  2286. 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
  2287. return wvec,vec
  2288. end
  2289. end
  2290. if part.className == "WedgePart" then
  2291. return part.CFrame:vectorToWorldSpace(Vector3.new(0,0.707,-0.707)), Vector3.new(0,0.707,-0.707)
  2292. end
  2293. end
  2294.  
  2295. function HWallRun(part, pos, side)
  2296. if (part.className == "Part" and part.Shape == Enum.PartType.Block) or part.className ~= "Part" then
  2297. flow.Value = flow.Value + 9
  2298. Standing = false
  2299. HWallRunning = true
  2300. Action = "HWallRunning"
  2301. GravPoint = 10
  2302. HWRLastPart = part
  2303. local dir, dirc = FindSurface(part, pos)
  2304. towall = -dir
  2305. dir = (CFrame.new(NV, dir) * CFrame.Angles(0,side,0)).lookVector
  2306.  
  2307. local bv = Instance.new("BodyVelocity", Torsoz)
  2308. bv.Name = "StaminaBodyObject"
  2309. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  2310. bv.P = 9000
  2311. bv.velocity = (dir*(sprint-0.5)) + Vector3.new(0,GravPoint,0)
  2312. local bg = Instance.new("BodyGyro", Torsoz)
  2313. bg.Name = "StaminaBodyObject"
  2314. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  2315. bg.cframe = CFrame.new(Torsoz.Position+(towall*-2), Torsoz.Position) * CFrame.Angles(0,-side,-side/4.2)
  2316. bg.D = 100
  2317.  
  2318. local sid = Instance.new("Snap")
  2319.  
  2320. local joint1 = Joint3
  2321. if side == -math.pi/2 then
  2322. 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))
  2323. else
  2324. sid = joint1
  2325. SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.6,0), Vector3.new(-math.pi/12,0,math.pi/7))
  2326. end
  2327. local j1c0 = joint1.C0
  2328.  
  2329. local joint2 = Joint4
  2330. if side == math.pi/2 then
  2331. 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))
  2332. else
  2333. sid = joint2
  2334. SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.6,0), Vector3.new(-math.pi/12,0,-math.pi/7))
  2335. end
  2336. local j2c0 = joint2.C0
  2337.  
  2338. local joint3 = Joint1
  2339. joint3.C1 = CFrame.new(0,1,0)
  2340. if side == -math.pi/2 then
  2341. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.5,-0.38,-0.3), Vector3.new(0,math.pi/2,0.14))
  2342. else
  2343. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.5,-0.8,-0.2), Vector3.new(0,math.pi/2,0.2))
  2344. end
  2345.  
  2346. local joint4 = Joint2
  2347. joint4.C1 = CFrame.new(0,1,0)
  2348. if side == -math.pi/2 then
  2349. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.5,-0.8,-0.2), Vector3.new(0,0,0.2))
  2350. else
  2351. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.5,-0.38,-0.3), Vector3.new(0,0,0.14))
  2352. end
  2353.  
  2354. local joint5 = Joint5
  2355. SetWeld(joint5,1,1,NV,NV,Vector3.new(0,0.9,0),Vector3.new(0,0,side/7))
  2356.  
  2357. Torsoz.CFrame = CFrame.new(pos+(towall*-2), pos) * CFrame.Angles(0,-side,-side/2.2)
  2358. bg.cframe = CFrame.new(pos+(towall*-2), pos) * CFrame.Angles(0,-side,-side/2.2)
  2359.  
  2360. local aniangle = 0
  2361. local aniplus = true
  2362. local aniangle2 = 0
  2363. local aniplus2 = true
  2364.  
  2365. local prevpart = part
  2366. HWRLastPart = part
  2367. while HWallRunning == true do
  2368.  
  2369. if aniangle > math.pi then
  2370. aniplus = false
  2371. elseif aniangle < -math.pi then
  2372. aniplus = true
  2373. end
  2374. if aniplus == true then
  2375. aniangle = aniangle + 0.95
  2376. elseif aniplus == false then
  2377. aniangle = aniangle - 0.95
  2378. end
  2379.  
  2380. if aniangle2 > math.pi then
  2381. aniplus2 = false
  2382. elseif aniangle2 < -math.pi then
  2383. aniplus2 = true
  2384. end
  2385. if aniplus2 == true then
  2386. aniangle2 = aniangle2 + 0.23
  2387. elseif aniplus2 == false then
  2388. aniangle2 = aniangle2 - 0.23
  2389. end
  2390.  
  2391. Hu.PlatformStand = true
  2392. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-3,0))
  2393. local hitz2, enz2 = RAY(Torsoz.Position, towall*3.4)
  2394.  
  2395. --- if player ends wall run on ground
  2396. if hitz ~= nil and hitz.CanCollide == true then
  2397. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,0)
  2398. local offset = (bg.cframe.p.y+enz2.y) - bg.cframe.p.y
  2399. Torsoz.CFrame = CFrame.new(Vector3.new(bg.cframe.p.x,offset,bg.cframe.p.z), enz2) * CFrame.Angles(0,-side,0)
  2400. Torsoz.Velocity = NV
  2401. break
  2402. end
  2403.  
  2404. ---- if new wall found --------
  2405. if hitz2 ~= nil and hitz2.CanCollide == true then
  2406. if hitz2 ~= prevpart then
  2407. local direct = CFrame.new(Torsoz.Position, Torsoz.Position+dir) * CFrame.Angles(0,side,0)
  2408. local hitz3, enz3 = RAY(Torsoz.Position, (direct * CFrame.Angles(0,-side/2.3,0)).lookVector*4)
  2409. if hitz3 ~= nil then
  2410. Torsoz.CFrame = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side*1.1,-side/2.2)
  2411. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side*1.1,-side/2.2)
  2412. dir, dirc = FindSurface(hitz2, enz2)
  2413. towall = -dir
  2414. dir = (CFrame.new(NV, dir) * CFrame.Angles(0,side,0)).lookVector
  2415. prevpart = hitz2
  2416. HWRLastPart = hitz2
  2417. else
  2418. ---- if player fails to find new wall to run on
  2419. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  2420. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  2421. Torsoz.Velocity = NV
  2422. HWRCooldown = 8
  2423. break
  2424. end
  2425. end
  2426. --- continue to wall run
  2427. Torsoz.CFrame = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,-side/2.2)
  2428. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,-side/2.2)
  2429. else
  2430. ---- if player ends wall run at end of wall
  2431. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  2432. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  2433. Torsoz.Velocity = NV
  2434. HWRCooldown = 8
  2435. break
  2436. end
  2437.  
  2438. local hitz3, enz3 = RAY(Torsoz.Position, Torsoz.CFrame.lookVector*2)
  2439. if hitz3 ~= nil and hitz3.CanCollide == true then
  2440. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  2441. bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
  2442. Torsoz.Velocity = NV
  2443. HWRCooldown = 8
  2444. break
  2445. end
  2446.  
  2447. bv.Parent = Torsoz
  2448. bv.velocity = (dir*(sprint-0.5)) + Vector3.new(0,GravPoint,0)
  2449. bg.cframe = bg.cframe * CFrame.Angles(aniangle/80,aniangle/80,0)
  2450. Torsoz.CFrame = Torsoz.CFrame * CFrame.Angles(aniangle/80,aniangle/80,0)
  2451. local j3,j3a = GetWeld(joint3)
  2452. local j4,j4a = GetWeld(joint4)
  2453. SetWeld(joint3,1,1, j3,j3a, j3,Vector3.new(-0.2+(aniangle/4),0,0))
  2454. SetWeld(joint4,1,1, j4,j4a, j4,Vector3.new(-0.2+(-aniangle/4),0,0))
  2455. if side == math.pi/2 then
  2456. local j1,j1a = GetWeld(joint1)
  2457. SetWeld(joint1,1,1, j1,j1a, j1, Vector3.new(0,0,0.8+(aniangle2/14)))
  2458. else
  2459. local j2,j2a = GetWeld(joint2)
  2460. SetWeld(joint2,1,1, j2,j2a, j2, Vector3.new(0,0,-0.8-(aniangle2/14)))
  2461. end
  2462.  
  2463. wait(0.025)
  2464. if GravPoint < -100 then
  2465. bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,0)
  2466. local offset = math.abs((bg.cframe.p.y+enz2.y) - bg.cframe.p.y)
  2467. Torsoz.CFrame = CFrame.new(Vector3.new(bg.cframe.p.x,offset,bg.cframe.p.z), enz2) * CFrame.Angles(0,-side,0)
  2468. break
  2469. end
  2470.  
  2471. end
  2472.  
  2473. if HWallRunning == "Jumping" then
  2474. HWRCooldown = 6
  2475. joint1.C1 = CFrame.new(0,0.5,0)
  2476.  
  2477. joint2.C1 = CFrame.new(0,0.5,0)
  2478. if side == -math.pi/2 then
  2479. joint2.C0 = CFrame.new(-1.35,0.5,0) * CFrame.Angles(0,side/2.4,-math.pi/3)
  2480. else
  2481. joint2.C0 = CFrame.new(-1.35,0.5,0) * CFrame.Angles(0,side/2.4,-math.pi/4)
  2482. end
  2483.  
  2484. joint3.C1 = CFrame.new(0,1,0)
  2485. if side == -math.pi/2 then
  2486. joint3.C0 = CFrame.new(0.5,-0.8,0) * CFrame.Angles(0,math.pi+(side/2.4),-math.pi/4)
  2487. else
  2488. joint3.C0 = CFrame.new(0.5,-0.8,0) * CFrame.Angles(0,(side/2.4),math.pi/4)
  2489. end
  2490. joint4.MaxVelocity = 10
  2491. joint4.DesiredAngle = 0
  2492. joint4.C1 = CFrame.new(0,1,0)
  2493. if side == -math.pi/2 then
  2494. joint4.C0 = CFrame.new(-0.5,-0.8,0) * CFrame.Angles(0,math.pi+(side/2.4),math.pi/4)
  2495. else
  2496. joint4.C0 = CFrame.new(-0.5,-0.8,0) * CFrame.Angles(0,(side/2.4),-math.pi/4)
  2497. end
  2498.  
  2499. local joint5 = Joint5
  2500. joint5.C1 = CFrame.new(0,-0.5,0) * CFrame.Angles(0,side/2.4,0)
  2501. joint5.C0 = CFrame.new(0,1,0)
  2502.  
  2503. local j1,j1a = GetWeld(joint1)
  2504. local j2,j2a = GetWeld(joint2)
  2505. local j3,j3a = GetWeld(joint3)
  2506. local j4,j4a = GetWeld(joint4)
  2507. local j5,j5a = GetWeld(joint5)
  2508.  
  2509. GravPoint = 26
  2510. local collidecount = 0
  2511. local bgangle = side/2
  2512. local count = 1
  2513. local dir2 = (CFrame.new(NV, dir) * CFrame.Angles(0,-side/2.4,0)).lookVector
  2514. HWRDir = dir2
  2515. bv.velocity = (dir2*(sprint+5)) + Vector3.new(0,GravPoint,0)
  2516. while HWallRunning == "Jumping" do
  2517. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-4,0))
  2518. local hitz2, enz2 = RAY(Torsoz.Position, dir2*1.4)
  2519. if hitz ~= nil and hitz.CanCollide == true then
  2520. local offset = math.abs(enz.y - Torsoz.CFrame.p.y)
  2521. Torsoz.CFrame = CFrame.new(enz+Vector3.new(0,2.9,0), enz+Vector3.new(0,2.9,0)+dir2)
  2522. Torsoz.Velocity = NV
  2523. break
  2524. end
  2525.  
  2526. if hitz2 ~= nil and hitz2.CanCollide == true then
  2527. collidecount = collidecount + 1
  2528. if collidecount == 4 then
  2529. Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir2) * CFrame.new(0,0,0.4)
  2530. Torsoz.Velocity = Vector3.new(0,Torsoz.Velocity.y,0)
  2531. HWRCooldown = 5
  2532. VWRCooldown = 5
  2533. wait(0.02)
  2534. break
  2535. end
  2536. end
  2537.  
  2538. if side/2 > 0 then
  2539. if bgangle > 0.2 then
  2540. bgangle = bgangle - 0.055
  2541. end
  2542. else
  2543. if bgangle < -0.2 then
  2544. bgangle = bgangle + 0.055
  2545. end
  2546. end
  2547.  
  2548. if count <= 5 then
  2549. if side == -math.pi/2 then
  2550. SetWeld(joint1,count,5, j1,j1a, Vector3.new(1.35,0.5,0), Vector3.new(0,side/2.4,math.pi/4))
  2551. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-1.35,0.5,0), Vector3.new(0,side/2.4,-math.pi/3))
  2552. SetWeld(joint3,count,5, j3,j3a, Vector3.new(0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  2553. joint3.C0 = joint3.C0 * CFrame.Angles((-math.pi/4)/5*count,0,0)
  2554. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  2555. joint4.C0 = joint4.C0 * CFrame.Angles((math.pi/4)/5*count,0,0)
  2556. else
  2557. SetWeld(joint1,count,5, j1,j1a, Vector3.new(1.35,0.5,0), Vector3.new(0,side/2.4,math.pi/3))
  2558. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-1.35,0.5,0), Vector3.new(0,side/2.4,-math.pi/4))
  2559. SetWeld(joint3,count,5, j3,j3a, Vector3.new(0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  2560. joint3.C0 = joint3.C0 * CFrame.Angles((math.pi/4)/5*count,0,0)
  2561. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
  2562. joint4.C0 = joint4.C0 * CFrame.Angles((-math.pi/4)/5*count,0,0)
  2563. end
  2564.  
  2565. count = count + 1
  2566. end
  2567.  
  2568. bg.Parent = Torsoz
  2569. bg.cframe = CFrame.new(NV, dir) * CFrame.Angles(0,side/15,-bgangle)
  2570. bv.velocity = (dir2*(sprint+5)) + Vector3.new(0,GravPoint,0)
  2571. if collidecount ~= 0 then
  2572. bv.velocity = Vector3.new(0,bv.velocity.y,0)
  2573. end
  2574. if GravPoint < -120 then
  2575. break
  2576. end
  2577. wait(0.025)
  2578. end
  2579. end
  2580.  
  2581. Hu.PlatformStand = false
  2582. bv:remove()
  2583.  
  2584. HWRGravDrop = false
  2585. Stand()
  2586. HWallRunning = false
  2587. end
  2588. end
  2589.  
  2590. function VWR(part, pos)
  2591. if (part.className == "Part" and part.Shape == Enum.PartType.Block) or part.className ~= "Part" then
  2592. print("VWR Activated")
  2593. flow.Value = flow.Value + 9
  2594. Standing = false
  2595. VWallRunning = true
  2596. Action = "VWallRunning"
  2597. GravPoint = 0
  2598. local percent = 1
  2599. VWRLastPart = part
  2600. local dir, dirc = FindSurface(part, pos)
  2601. towall = -dir
  2602. dir = (CFrame.new(NV, -dir) * CFrame.Angles(math.pi/2,0,0)).lookVector
  2603. --[[
  2604. local p = P:Clone()
  2605. p.Parent = char
  2606. p.Size = Vector3.new(2,2,2)
  2607. p.BrickColor = BrickColor.new("Lime green")
  2608. p.CanCollide = false
  2609. p.CFrame = part.CFrame * CFrame.new(dirc*5)
  2610. p.Transparency = 0.3
  2611. ]]
  2612. local bv = Instance.new("BodyVelocity", Torsoz)
  2613. bv.Name = "StaminaBodyObject"
  2614. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  2615. bv.P = 9000
  2616. bv.velocity = (dir*(sprint-1))*percent
  2617.  
  2618. local bg = Instance.new("BodyGyro", Torsoz)
  2619. bg.Name = "StaminaBodyObject"
  2620. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  2621. bg.D = 100
  2622. local posi = pos + (-towall*1.8)
  2623. bg.cframe = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0)
  2624. Torsoz.CFrame = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0)
  2625.  
  2626. local joint1 = Joint3
  2627. SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,0,math.pi/8))
  2628.  
  2629. local joint2 = Joint4
  2630. SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,0,-math.pi/8))
  2631.  
  2632. local joint3 = Joint1
  2633. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.48,-0.6,-0.1), Vector3.new(0,math.pi/2,0))
  2634. joint3.C1 = CFrame.new(0,0.7,0.2) * CFrame.Angles(0,math.pi/2,0)
  2635.  
  2636. local joint4 = Joint2
  2637. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.48,-0.6,-0.1), Vector3.new(0,math.pi/2,0))
  2638. joint4.C1 = CFrame.new(0,0.7,0.2) * CFrame.Angles(0,math.pi/2,0)
  2639.  
  2640. local joint5 = Joint5
  2641. SetWeld(joint5,1,1, NV,NV, Vector3.new(0,1,0), Vector3.new(math.pi/20,0,0))
  2642.  
  2643. local aniangle = 0
  2644. local aniplus = true
  2645.  
  2646. while VWallRunning == true do
  2647. local hitz, enz = RAY(Torsoz.Position, towall*2.1)
  2648. local hitz2, enz2 = RAY(Torsoz.Position, (CFrame.new(NV,towall)*CFrame.Angles(math.pi/2,0,0)).lookVector*2.4)
  2649.  
  2650. if aniangle > math.pi then
  2651. aniplus = false
  2652. elseif aniangle < -math.pi then
  2653. aniplus = true
  2654. end
  2655. if aniplus == true then
  2656. aniangle = aniangle + (1.3*(percent+0.2))
  2657. elseif aniplus == false then
  2658. aniangle = aniangle - (1.3*(percent+0.2))
  2659. end
  2660.  
  2661. bv.velocity = (dir*(sprint-1))*percent
  2662. if VWRLeft == true then
  2663. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * (11*percent+5))
  2664. end
  2665. if VWRRight == true then
  2666. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * (11*percent+5))
  2667. end
  2668.  
  2669. bg.cframe = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0) * CFrame.Angles(0,aniangle/60,0)
  2670.  
  2671. 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)))
  2672. 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)))
  2673. SetWeld(joint3,1,1, NV,NV, Vector3.new(0.51,-0.75,-(aniangle/30)), Vector3.new(0,math.pi/2,(aniangle/8)-0.3))
  2674. SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.51,-0.75,(aniangle/30)), Vector3.new(0,math.pi/2,(-aniangle/8)-0.3))
  2675.  
  2676. if hitz == nil then
  2677. local lv = Torsoz.Position + (Torsoz.CFrame.lookVector*100)
  2678. Torsoz.CFrame = CFrame.new(Torsoz.Position, Vector3.new(lv.x,Torsoz.Position.y,lv.z))
  2679. break
  2680. end
  2681.  
  2682. if hitz2 ~= nil then
  2683. percent = 0
  2684. VWallRunning = "Falling"
  2685. Action = "VWRFalling"
  2686. GravPoint = -7
  2687. break
  2688. end
  2689.  
  2690. wait(0.02)
  2691. percent = percent - 0.028
  2692. if percent <= 0.15 then
  2693. VWallRunning = "Falling"
  2694. Action = "VWRFalling"
  2695. end
  2696. end
  2697.  
  2698. -------------------------- Falling from VWR ------------------------------
  2699. if VWallRunning == "Falling" then
  2700. GravPoint = GravPoint - 1
  2701. local dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  2702. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  2703.  
  2704. local j1,j1a = GetWeld(joint1)
  2705. local j2,j2a = GetWeld(joint2)
  2706. local j3,j3a = GetWeld(joint3)
  2707. local j4,j4a = GetWeld(joint4)
  2708. local j5,j5a = GetWeld(joint5)
  2709.  
  2710. local counter = 0
  2711. while VWallRunning == "Falling" do
  2712. counter = counter + 1
  2713. local hitz, enz = RAY(H.Position, Vector3.new(0,-2.4,0))
  2714.  
  2715. dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  2716. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  2717. if VWRLeft == true then
  2718. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  2719. end
  2720. if VWRRight == true then
  2721. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  2722. end
  2723. bg.cframe = CFrame.new(NV, (-towall*30) + Vector3.new(0,GravPoint,0)) * CFrame.Angles(-math.pi/2.55,math.pi,0)
  2724.  
  2725. if counter <= 35 then
  2726. SetWeld(joint1,counter,35, j1,j1a, Vector3.new(1.4,0.45,-0.1), Vector3.new(math.pi/9,0,math.pi/9))
  2727. SetWeld(joint2,counter,35, j2,j2a, Vector3.new(-1.4,0.45,-0.1), Vector3.new(math.pi/9,0,-math.pi/9))
  2728. SetWeld(joint3,counter,35, j3,j3a, Vector3.new(0.5,-0.75,0), Vector3.new(0,math.pi/2,math.pi/9))
  2729. joint3.C1 = CFrame.new(0,0.7 + (0.3/35*counter),0.2 - (0.2/35*counter)) * CFrame.Angles(0,math.pi/2,0)
  2730. SetWeld(joint4,counter,35, j4,j4a, Vector3.new(-0.5,-0.75,0), Vector3.new(0,math.pi/2,math.pi/9))
  2731. joint4.C1 = CFrame.new(0,0.7 + (0.3/35*counter),0.2 - (0.2/35*counter)) * CFrame.Angles(0,math.pi/2,0)
  2732. SetWeld(joint5,counter,35, j5,j5a, Vector3.new(0,1,0), Vector3.new(-math.pi/6,0,0))
  2733. end
  2734.  
  2735. if hitz ~= nil then
  2736. bv:remove()
  2737. 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)
  2738. Torsoz.Velocity = NV
  2739. Torsoz.RotVelocity = NV
  2740. local bp = Instance.new("BodyPosition", Torsoz)
  2741. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  2742. bp.position = Torsoz.CFrame.p
  2743. game:service("Debris"):AddItem(bp, 0.16)
  2744. flow.Value = 0
  2745. break
  2746. end
  2747.  
  2748. if GravPoint > - 180 then
  2749. GravPoint = GravPoint - 1.9
  2750. end
  2751. if counter > 200 then
  2752. break
  2753. end
  2754. wait(0.02)
  2755. end
  2756.  
  2757. local bp = Instance.new("BodyPosition")
  2758.  
  2759. local counter2 = counter
  2760. local bgangleplus = 0
  2761.  
  2762. local j1,j1a = GetWeld(joint1)
  2763. local j2,j2a = GetWeld(joint2)
  2764. local j3,j3a = GetWeld(joint3)
  2765. local j4,j4a = GetWeld(joint4)
  2766. local j5,j5a = GetWeld(joint5)
  2767.  
  2768. local landingpos
  2769.  
  2770. while VWallRunning == "BackflipFromFall" do
  2771. counter2 = counter2 + 1
  2772. local hitz, enz = RAY(H.Position+Vector3.new(0,2,0), Vector3.new(0,-4.4,0))
  2773.  
  2774. if counter2 - counter < 13 then
  2775. bgangleplus = bgangleplus - ((math.pi*1.1)/13)
  2776. end
  2777. if counter2 - counter <= 13 then
  2778. 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))
  2779. 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))
  2780. SetWeld(joint3,counter2-counter,13, j3,j3a, Vector3.new(0.52,-0.3,-0.65), Vector3.new(0,math.pi/2,0))
  2781. SetWeld(joint4,counter2-counter,13, j4,j4a, Vector3.new(-0.51,-0.9,-0.05), Vector3.new(0,math.pi/2,0))
  2782. SetWeld(joint5,counter2-counter,13, j5,j5a, Vector3.new(0,0.9,0), Vector3.new(-math.pi/7,0,0))
  2783. end
  2784.  
  2785. dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
  2786. --bv.velocity = Vector3.new(0,-2,0)
  2787. bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
  2788. if VWRLeft == true then
  2789. bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  2790. end
  2791. if VWRRight == true then
  2792. bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
  2793. end
  2794. bg.cframe = CFrame.new(NV, (-towall*30) + Vector3.new(0,GravPoint,0)) * CFrame.Angles((-math.pi/2.4) + bgangleplus,math.pi,0)
  2795.  
  2796. if hitz ~= nil then
  2797. bv:remove()
  2798. landingpos = enz - (towall*1.3)
  2799. if counter2 - counter > 8 then
  2800. bp = Instance.new("BodyPosition", Torsoz)
  2801. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  2802. bp.position = enz+Vector3.new(0,2.4,0) + (-towall*1)
  2803. VWallRunning = "LandingFall"
  2804. else
  2805. Torsoz.CFrame = bg.cframe + (enz+Vector3.new(0,2.3,0))
  2806. Torsoz.Velocity = NV
  2807. Torsoz.RotVelocity = NV
  2808. local bp = Instance.new("BodyPosition", Torsoz)
  2809. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  2810. bp.position = Torsoz.CFrame.p
  2811. game:service("Debris"):AddItem(bp, 0.14)
  2812. flow.Value = 0
  2813. end
  2814. break
  2815. end
  2816.  
  2817. if GravPoint > - 180 then
  2818. GravPoint = GravPoint - 1.9
  2819. end
  2820. if counter2 > 200 then
  2821. break
  2822. end
  2823. wait(0.02)
  2824. end
  2825.  
  2826. if VWallRunning == "LandingFall" then
  2827. print("Landing")
  2828.  
  2829. joint3.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  2830. joint4.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  2831. local j1,j1a = GetWeld(joint1)
  2832. local j2,j2a = GetWeld(joint2)
  2833. local j3,j3a = GetWeld(joint3)
  2834. local j4,j4a = GetWeld(joint4)
  2835. local j5,j5a = GetWeld(joint5)
  2836.  
  2837. local a
  2838. local mesh
  2839. if GravPoint < -70 then
  2840. a = P:Clone()
  2841. a.Parent = Torsoz
  2842. a.Name = "AirLandingEffect"
  2843. a.BrickColor = BrickColor.new("Medium stone grey")
  2844. a.Transparency = 0.3
  2845. a.CFrame = CFrame.new(landingpos+Vector3.new(0,0.4,0))
  2846. mesh = Instance.new("SpecialMesh", a)
  2847. mesh.MeshId = "http://www.roblox.com/asset/?id=20329976"
  2848. mesh.Scale = Vector3.new(0,0,0)
  2849. end
  2850.  
  2851. local bgcf = CFrame.new(NV, Vector3.new(towall.x,0,towall.z))
  2852. bg.cframe = bgcf * CFrame.Angles(-math.pi/7,0,0)
  2853. local bgval = math.pi/7/2
  2854.  
  2855. for i = 1, 6 do
  2856. Hu.PlatformStand = true
  2857. 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))
  2858. 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))
  2859. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.51,-0.3,-0.8), Vector3.new(0,math.pi/2,-math.pi/7))
  2860. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.51,-0.8,-0.7), Vector3.new(0,math.pi/2,-math.pi/3))
  2861. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,0.85,0), Vector3.new(-math.pi/8,0,0))
  2862. bp.position = bp.position + Vector3.new(0,-0.07,0)
  2863. bg.cframe = bgcf * CFrame.Angles((-bgval*2) + (bgval/6*i),0,0)
  2864. Torsoz.CFrame = bg.cframe + bp.position
  2865. if a ~= nil then
  2866. mesh.Scale = mesh.Scale + Vector3.new(1.3,0.35,1.3)
  2867. a.Transparency = 0.3 + (0.7/6*i)
  2868. end
  2869. wait(0.02)
  2870. end
  2871. if a ~= nil then
  2872. a:remove()
  2873. end
  2874. local j1,j1a = GetWeld(joint1)
  2875. local j2,j2a = GetWeld(joint2)
  2876. local j3,j3a = GetWeld(joint3)
  2877. local j4,j4a = GetWeld(joint4)
  2878. local j5,j5a = GetWeld(joint5)
  2879. for i = 1, 6 do
  2880. Hu.PlatformStand = true
  2881. SetWeld(joint1,i,6, j1,j1a, Vector3.new(1.5,0.5,0), Vector3.new(0,0,0))
  2882. SetWeld(joint2,i,6, j2,j2a, Vector3.new(-1.5,0.5,0), Vector3.new(0,0,0))
  2883. SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.5,-1,0), Vector3.new(0,math.pi/2,0))
  2884. SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.5,-1,0), Vector3.new(0,math.pi/2,0))
  2885. SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,1,0), Vector3.new(0,0,0))
  2886. bp.position = bp.position + Vector3.new(0,0.1,0)
  2887. bg.cframe = bgcf * CFrame.Angles(-bgval + (bgval/6*i),0,0)
  2888. Torsoz.CFrame = bg.cframe + bp.position
  2889. wait(0.02)
  2890. end
  2891.  
  2892. bp:remove()
  2893. end
  2894.  
  2895. end
  2896.  
  2897. bv:remove()
  2898. bg:remove()
  2899. VWallRunning = false
  2900. Stand()
  2901. end
  2902. end
  2903.  
  2904. function Slide(pos)
  2905. flow.Value = flow.Value + 6
  2906. Action = "Sliding"
  2907. Sliding = true
  2908. GravPoint = Torsoz.Velocity.y
  2909. local spd = Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude + 10
  2910. local dir = Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).unit
  2911.  
  2912. local bv = Instance.new("BodyVelocity", Torsoz)
  2913. bv.maxForce = Vector3.new(1/0,1/0,1/0)
  2914. bv.velocity = dir*spd
  2915. local bg = Instance.new("BodyGyro", Torsoz)
  2916. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  2917. bg.cframe = CFrame.new(NV, dir) * CFrame.Angles(math.pi/2.2,0.24,0)
  2918.  
  2919. local joint1 = Joint1
  2920. local joint2 = Joint2
  2921. local joint3 = Joint3
  2922. local joint4 = Joint4
  2923. local joint5 = Joint5
  2924. local j1,j1a = GetWeld(joint1)
  2925. local j2,j2a = GetWeld(joint2)
  2926.  
  2927. SetWeld(joint1,1,1, NV,NV, Vector3.new(j1.x,j1.y,j1.z), Vector3.new(j1a.x,math.pi/2,j1a.z))
  2928. joint1.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  2929. SetWeld(joint2,1,1, NV,NV, Vector3.new(j2.x,j2.y,j2.z), Vector3.new(j2a.x,math.pi/2,j2a.z))
  2930. joint2.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
  2931.  
  2932. local j1,j1a = GetWeld(joint1)
  2933. local j2,j2a = GetWeld(joint2)
  2934. local j3,j3a = GetWeld(joint3)
  2935. local j4,j4a = GetWeld(joint4)
  2936. local j5,j5a = GetWeld(joint5)
  2937.  
  2938. local count = 0
  2939. local lastpos
  2940.  
  2941. while Sliding == true do
  2942. count = count + 1
  2943. Hu.PlatformStand = true
  2944. local hitz1, enz1 = RAY(Torsoz.Position+Vector3.new(0,0.03,0), dir *2.5)
  2945. local hitz2, enz2 = RAY(Torsoz.Position-Vector3.new(0,0.2,0), dir *2.5)
  2946. local ghitz, genz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  2947. bv.velocity = dir*spd + Vector3.new(0,GravPoint,0)
  2948.  
  2949. if count <= 5 then
  2950. SetWeld(joint1,count,5, j1,j1a, Vector3.new(0.5,-0.8,-0.15), Vector3.new(0,(math.pi/2)+0.1,-0.4))
  2951. SetWeld(joint2,count,5, j2,j2a, Vector3.new(-0.5,-1,0), Vector3.new(0,(math.pi/2)-0.4,0))
  2952. SetWeld(joint3,count,5, j3,j3a, Vector3.new(1.5,0.5,0), Vector3.new(-0.7,-0.24,math.pi/5))
  2953. SetWeld(joint4,count,5, j4,j4a, Vector3.new(-1.5,0.5,0), Vector3.new(-0.1,0,-math.pi/1.5))
  2954. SetWeld(joint5,count,5, j5,j5a, Vector3.new(0,1,0), Vector3.new(-0.5,-0.2,0))
  2955. end
  2956.  
  2957. if (hitz1 ~= nil and hitz1.CanCollide == true) or (hitz2 ~= nil and hitz2.CanCollide == true) then
  2958. bv:remove()
  2959. bg:remove()
  2960. Sliding = "HitObject"
  2961. end
  2962. if ghitz ~= nil then
  2963. GravPoint = 0
  2964. Torsoz.CFrame = CFrame.new(genz, genz+dir) * CFrame.Angles(math.pi/2.2,0.24,0) + Vector3.new(0,0.7,0)
  2965. spd = spd - 0.95
  2966. else
  2967. if GravPoint > -180 then
  2968. GravPoint = GravPoint - 5.6
  2969. end
  2970. spd = spd - 0.36
  2971. end
  2972. if spd < 7 then
  2973. Sliding = false
  2974. end
  2975. wait(0.02)
  2976. end
  2977.  
  2978. if Sliding == false then
  2979. local j1,j1a = GetWeld(joint1)
  2980. local j2,j2a = GetWeld(joint2)
  2981. local j3,j3a = GetWeld(joint3)
  2982. local j4,j4a = GetWeld(joint4)
  2983. local j5,j5a = GetWeld(joint5)
  2984. for i = 1, 4 do
  2985. SetWeld(joint1,i,4, j1,j1a, Vector3.new(0.5,-1,0), Vector3.new(0,math.pi/2,0))
  2986. SetWeld(joint2,i,4, j2,j2a, Vector3.new(-0.5,-1,0), Vector3.new(0,math.pi/2,0))
  2987. SetWeld(joint3,i,4, j3,j3a, Vector3.new(1.5,0.5,0), NV)
  2988. SetWeld(joint4,i,4, j4,j4a, Vector3.new(-1.5,0.5,0), NV)
  2989. SetWeld(joint5,i,4, j5,j5a, Vector3.new(0,1,0), NV)
  2990. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  2991. 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)
  2992. bv.velocity = dir*spd + Vector3.new(0,GravPoint,0)
  2993.  
  2994. if hitz ~= nil then
  2995. GravPoint = 0
  2996. 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)
  2997. spd = spd - 0.95
  2998. else
  2999. if GravPoint > -180 then
  3000. GravPoint = GravPoint - 5.6
  3001. end
  3002. spd = spd - 0.36
  3003. end
  3004. wait(0.02)
  3005. end
  3006. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
  3007. Torsoz.CFrame = CFrame.new(enz, enz+dir) + Vector3.new(0,3,0)
  3008. end
  3009. bv:remove()
  3010. bg:remove()
  3011. SlideCooldown = 10
  3012. Stand()
  3013. end
  3014.  
  3015. function KD(key)
  3016. if pause.Value == false then
  3017. if key == string.char(32) then
  3018. Space = true
  3019.  
  3020. local ghitz, genz = RAY(Torsoz.Position, Vector3.new(0,-3.7,0))
  3021. local hitz, enz = RAY(Torsoz.Position+Vector3.new(0,1.1,0), Torsoz.CFrame.lookVector*2.3)
  3022. local righthitz, rightenz
  3023. local lefthitz, leftenz
  3024.  
  3025. if HWallRunning == false then
  3026. righthitz, rightenz = RAY(Torsoz.Position, ((Torsoz.CFrame * CFrame.new(1.5,0,-0.2)).p - Torsoz.CFrame.p).unit*3.9)
  3027. lefthitz, leftenz = RAY(Torsoz.Position, ((Torsoz.CFrame * CFrame.new(-1.5,0,-0.2)).p - Torsoz.CFrame.p).unit*3.9)
  3028.  
  3029. elseif HWallRunning == "Jumping" then
  3030. 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)
  3031. 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)
  3032.  
  3033. end
  3034.  
  3035. 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
  3036. if stamina >= 10 then
  3037. --if Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 12 then
  3038. Dive()
  3039. --end
  3040. end
  3041. end
  3042.  
  3043. if hitz == nil and VWallRunning == "Falling" then
  3044. VWallRunning = "BackflipFromFall"
  3045. end
  3046.  
  3047. if Shift == true and Torsoz.Velocity.y > -50 and Diving == false and DivingCooldown <= 0 then
  3048. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-3.5,0))
  3049.  
  3050. if hitz ~= nil then
  3051. if Action == "Standing" and VWRCooldown == 0 then
  3052. if hitz2 == nil or hitz2.CanCollide == false then
  3053. VWR(hitz, enz)
  3054. end
  3055. end
  3056. end
  3057.  
  3058. if (HWallRunning == false or (HWallRunning == "Jumping" and (HWRLastPart ~= righthitz or HWRLastPart ~= lefthitz))) and HWRCooldown == 0 and VWallRunning == false then
  3059.  
  3060. 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
  3061. if hitz2 == nil or hitz2.CanCollide == false then
  3062. local right = (rightenz - Torsoz.Position).magnitude
  3063. local left = (leftenz - Torsoz.Position).magnitude
  3064. if right < left then
  3065. if HWallRunning == "Jumping" and HWRLastPart ~= righthitz then
  3066. HWallRunning = false
  3067. while Standing == false do
  3068. wait(0.01)
  3069. end
  3070. print("2nd Right Activated!")
  3071. HWallRun(righthitz, rightenz, -math.pi/2)
  3072. else
  3073. if hitz == nil then
  3074. print("Right Activated")
  3075. HWallRun(righthitz, rightenz, -math.pi/2)
  3076. end
  3077. end
  3078. elseif left < right then
  3079. if HWallRunning == "Jumping" and HWRLastPart ~= lefthitz then
  3080. HWallRunning = false
  3081. while Standing == false do
  3082. wait(0.01)
  3083. end
  3084. print("2nd Left Activated!")
  3085. HWallRun(lefthitz, leftenz, math.pi/2)
  3086. else
  3087. if hitz == nil then
  3088. print("Left Activated")
  3089. HWallRun(lefthitz, leftenz, math.pi/2)
  3090. end
  3091. end
  3092. end
  3093. end
  3094. end
  3095. end
  3096.  
  3097. end
  3098.  
  3099. if HWallRunning == true then
  3100. HWallRunning = "Jumping"
  3101. Action = "HWRJumping"
  3102. end
  3103.  
  3104. elseif key == string.char(48) then
  3105. Shift = true
  3106. elseif key == string.char(50) then
  3107. if Action == "Standing" then
  3108. Sit()
  3109. elseif HWallRunning == true then
  3110. HWRGravDrop = true
  3111. end
  3112. elseif key == string.char(52) then
  3113. 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
  3114. print("Sliding")
  3115. Slide()
  3116. end
  3117. elseif key == "a" then
  3118. VWRLeft = true
  3119. elseif key == "d" then
  3120. VWRRight = true
  3121. end
  3122. end
  3123. end
  3124.  
  3125. function KU(key)
  3126. if key == string.char(32) then
  3127. Space = false
  3128. elseif key == string.char(48) then
  3129. Shift = false
  3130. elseif key == string.char(50) then
  3131. if Action == "Sitting" then
  3132. Stand()
  3133. end
  3134. elseif key == string.char(52) then
  3135. Sliding = false
  3136. elseif key == "a" then
  3137. VWRLeft = false
  3138. elseif key == "d" then
  3139. VWRRight = false
  3140. end
  3141. end
  3142.  
  3143. mouse.KeyDown:connect(function(key) KD(key) end)
  3144. mouse.KeyUp:connect(function(key) KU(key) end)
  3145.  
  3146. Joint1 = Instance.new("Snap", Torsoz)
  3147. GetWeld(Joint1)
  3148. Joint2 = Instance.new("Snap", Torsoz)
  3149. GetWeld(Joint2)
  3150. Joint3 = Instance.new("Snap", Torsoz)
  3151. GetWeld(Joint3)
  3152. Joint4 = Instance.new("Snap", Torsoz)
  3153. GetWeld(Joint4)
  3154. Joint5 = Instance.new("Snap", Torsoz)
  3155. GetWeld(Joint5)
  3156. Stand()
  3157.  
  3158. local animatebg = Instance.new("BodyGyro")
  3159. animatebg.D = 100
  3160. local GravAction = "Idle"
  3161. local PrevGravAction = GravAction
  3162.  
  3163. local prevrapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  3164. local prevlapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  3165. local hue = 0
  3166. local recyclecount = 0
  3167. local tickoffset = tick()
  3168. local fadetab = {}
  3169. local fadetab2 = {}
  3170. local animatebgcount = 0
  3171.  
  3172. for i = 1, 13 do
  3173. local p = P:Clone()
  3174. p.Name = "Part"..i
  3175. local mesh = Instance.new("SpecialMesh", p)
  3176. mesh.MeshId = "http://www.roblox.com/Asset/?id=9856898"
  3177. mesh.TextureId = "http://www.roblox.com/Asset/?id=48358980"
  3178. table.insert(fadetab, {p, mesh})
  3179. end
  3180. for i = 1, 13 do
  3181. local p = P:Clone()
  3182. p.Name = "Part"..i
  3183. local mesh = Instance.new("SpecialMesh", p)
  3184. mesh.MeshId = "http://www.roblox.com/Asset/?id=9856898"
  3185. mesh.TextureId = "http://www.roblox.com/Asset/?id=48358980"
  3186. table.insert(fadetab2, {p, mesh})
  3187. end
  3188.  
  3189. game:service("RunService").Stepped:connect(function()
  3190. GravAction = "Idle"
  3191. hue = hue + 3
  3192. hue = hue % 360
  3193.  
  3194. ------------- anim angle changing --------
  3195. if animangle > math.pi then
  3196. animplus = false
  3197. elseif animangle < -math.pi then
  3198. animplus = true
  3199. end
  3200. if animplus == true then
  3201. animangle = animangle + animspeed
  3202. elseif animplus == false then
  3203. animangle = animangle - animspeed
  3204. end
  3205.  
  3206. local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-3.9,0))
  3207. if Shift == true then
  3208. Hu.WalkSpeed = sprint
  3209. else
  3210. Hu.WalkSpeed = 16
  3211. end
  3212. if (FOV >= 70 and FOV < 74) and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 25 then
  3213. FOV = FOV + 1
  3214. elseif (FOV <= 74 and FOV > 70) and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude < 20 then
  3215. FOV = FOV - 1
  3216. end
  3217. if pause.Value == true then
  3218. Hu.WalkSpeed = 0
  3219. end
  3220. if Sitting == true then
  3221. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-2.2,0))
  3222. Hu.PlatformStand = true
  3223. if hitz2 == nil then
  3224. Stand()
  3225. end
  3226. end
  3227. if Diving == true then
  3228. Hu.PlatformStand = true
  3229. DivingBV.velocity = Vector3.new(DivingDir.x*(sprint+2),GravPoint,DivingDir.z*(sprint+2))
  3230. DivingBG.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+DivingBV.velocity) * CFrame.Angles(-math.pi/2,0,0)
  3231.  
  3232. if GravPoint > -180 then
  3233. GravPoint = GravPoint - 2
  3234. end
  3235. end
  3236. if DivingCooldown > 0 then
  3237. DivingCooldown = DivingCooldown - 1
  3238. end
  3239. if HWallRunning == true then
  3240. if HWRGravDrop == false then
  3241. GravPoint = GravPoint - 0.4
  3242. else
  3243. GravPoint = GravPoint - 2
  3244. end
  3245. elseif HWallRunning == "Jumping" then
  3246. GravPoint = GravPoint - 1.7
  3247. end
  3248. ----------------------------- stamina ----------------------------------------
  3249. if Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude > 18 and Action == "Standing" and Shift == true then
  3250. if stamina > 0 then
  3251. stamina = stamina - 0.5
  3252. if stamina < 0 then
  3253. Shift = false
  3254. stamina = 0
  3255. end
  3256. else
  3257. Shift = false
  3258. stamina = 0
  3259. end
  3260. if Action == "Standing" then
  3261. animspeed = 0.85
  3262. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/4.85,0,0))
  3263. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/4.85,0,0))
  3264. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/3.5,0,0))
  3265. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/3.5,0,0))
  3266. end
  3267. elseif Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude > 12 and Action ~= "Sliding" then
  3268. if stamina < maxstamina then
  3269. stamina = stamina + 0.5
  3270. if stamina > maxstamina then
  3271. stamina = maxstamina
  3272. end
  3273. else
  3274. stamina = maxstamina
  3275. end
  3276. if Action == "Standing" then
  3277. animspeed = 0.65
  3278. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/7,0,0))
  3279. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/7,0,0))
  3280. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/5,0,0))
  3281. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/5,0,0))
  3282. end
  3283. elseif Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude < 2 then
  3284. animspeed = 0.1
  3285. if Action == "Standing" then
  3286. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/38,0,0))
  3287. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/38,0,0))
  3288. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/30,0,0))
  3289. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/30,0,0))
  3290. end
  3291. if stamina < maxstamina then
  3292. if Sitting == false then
  3293. stamina = stamina + 0.65
  3294. else
  3295. stamina = stamina + 1.02
  3296. end
  3297. if stamina > maxstamina then
  3298. stamina = maxstamina
  3299. end
  3300. else
  3301. stamina = maxstamina
  3302. end
  3303. end
  3304.  
  3305. if hitz == nil then
  3306. if Torsoz.Velocity.y > 1 or (Torsoz.Velocity.y < -1 and Torsoz.Velocity.y > -90) then
  3307. if Action == "Standing" then
  3308. GravAction = "Rising"
  3309. animspeed = 0.1
  3310. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/38,0,0))
  3311. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/38,0,0))
  3312. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new((math.pi-0.2)+(animangle/30),0,0))
  3313. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new((math.pi-0.2)+(-animangle/30),0,0))
  3314. if animatebg.Parent ~= nil then
  3315. animatebg.Parent = Torsoz
  3316. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  3317. local lokvec = Torsoz.CFrame.lookVector*100
  3318. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z))
  3319. animatebg.Parent = nil
  3320. end
  3321. end
  3322. end
  3323. end
  3324.  
  3325. if hitz == nil then
  3326. local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-6,0))
  3327. if hitz2 == nil then
  3328. if Torsoz.Velocity.y < -90 then
  3329. if Action == "Standing" then
  3330. GravAction = "Falling"
  3331. animspeed = 1.1
  3332. animatebg.Parent = Torsoz
  3333. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  3334. local lokvec = Torsoz.CFrame.lookVector*100
  3335. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z)) * CFrame.Angles(-math.pi/11,animangle/70,0)
  3336. SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.45,-0.8,0), Vector3.new((animangle/27)-0.3,0,0.18))
  3337. SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.45,-0.8,0), Vector3.new((-animangle/27)-0.3,0,-0.18))
  3338. SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.4,0.5,0), Vector3.new((math.pi+0.2)+(animangle/26),0,0.18))
  3339. SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.4,0.5,0), Vector3.new((math.pi+0.2)+(-animangle/26),0,-0.18))
  3340. end
  3341. end
  3342. elseif hitz2.CanCollide == true then
  3343. if animatebg.Parent ~= nil then
  3344. animatebg.Parent = Torsoz
  3345. animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
  3346. local lokvec = Torsoz.CFrame.lookVector*100
  3347. animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z))
  3348. animatebg.Parent = nil
  3349. end
  3350. end
  3351. end
  3352.  
  3353. if GravAction == "Idle" and animatebg.Parent ~= nil then
  3354. animatebg.Parent = nil
  3355. end
  3356.  
  3357. if math.abs(tickoffset - tick()) > 0.05 then
  3358. tickoffset = tick()
  3359. local flowcolor = HSV(hue, 0.7,1)
  3360. recyclecount = (recyclecount % #fadetab) + 1
  3361. if flow.Value > 25 then
  3362. local lapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  3363. local rapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  3364. local p = fadetab[recyclecount]
  3365. p[1].Parent = m
  3366. p[1].CFrame = CFrame.new((lapos+prevlapos)/2, lapos)
  3367. p[2].Scale = Vector3.new(0.5,0.5,(lapos-prevlapos).magnitude*2)
  3368. p[2].VertexColor = Vector3.new(flowcolor.r,flowcolor.g,flowcolor.b)
  3369. p[1].Transparency = math.abs((flow.Value/120) - 0.8)
  3370. p[1].Transparency = p[1].Transparency + (1/#fadetab)
  3371. local p = fadetab2[recyclecount]
  3372. p[1].Parent = m
  3373. p[1].CFrame = CFrame.new((rapos+prevrapos)/2, rapos)
  3374. p[2].Scale = Vector3.new(0.5,0.5,(rapos-prevrapos).magnitude*2)
  3375. p[2].VertexColor = Vector3.new(flowcolor.r,flowcolor.g,flowcolor.b)
  3376. p[1].Transparency = math.abs((flow.Value/120) - 0.8)
  3377. p[1].Transparency = p[1].Transparency + (1/#fadetab)
  3378. end
  3379.  
  3380. for i, v in pairs(fadetab) do
  3381. if v[1].Transparency < 0.9 then
  3382. v[1].Transparency = v[1].Transparency + (1/#fadetab)
  3383. fadetab2[i][1].Transparency = fadetab2[i][1].Transparency + (1/#fadetab)
  3384. elseif v[1].Transparency ~= 1 then
  3385. v[1].Transparency = 1
  3386. v[1].Position = Vector3.new(50000,0,0)
  3387. fadetab2[i][1].Transparency = 1
  3388. fadetab2[i][1].Position = Vector3.new(50000,0,0)
  3389. end
  3390. end
  3391.  
  3392. prevrapos = (RA.CFrame * CFrame.new(0,-1,0)).p
  3393. prevlapos = (LA.CFrame * CFrame.new(0,-1,0)).p
  3394. end
  3395.  
  3396. if flow.Value > 140 then
  3397. if char.Parent ~= nil then
  3398. char:remove()
  3399. end
  3400. end
  3401.  
  3402. if flowcooldown > 0 then
  3403. flowcooldown = flowcooldown - 1
  3404. end
  3405. if HWRCooldown > 0 then
  3406. HWRCooldown = HWRCooldown - 1
  3407. end
  3408. if VWRCooldown > 0 then
  3409. if hitz ~= nil and VWRCooldown > 0 then
  3410. VWRCooldown = VWRCooldown - 1
  3411. end
  3412. end
  3413. if SlideCooldown > 0 then
  3414. SlideCooldown = SlideCooldown - 1
  3415. end
  3416.  
  3417. if Action == "HWallRunning" or Action == "VWallRunning" then
  3418. flow.Value = flow.Value + 0.24
  3419. if flow.Value > 100 then
  3420. flow.Value = 100
  3421. end
  3422. flowcooldown = 40
  3423. elseif Action == "Diving" then
  3424. flowcooldown = 30
  3425. elseif Action == "Sliding" then
  3426. flowcooldown = 15
  3427. elseif Action == "Standing" or Action == "Sitting" then
  3428. if flow.Value > 0 and flowcooldown <= 0 then
  3429. flow.Value = flow.Value - 0.37
  3430. if flow.Value < 0 then
  3431. flow.Value = 0
  3432. end
  3433. end
  3434. end
  3435.  
  3436. cam.FieldOfView = FOV
  3437. prevanimbgcount = animatebgcount
  3438. sprint = defsprint + ((flow.Value/100)*2.4)
  3439. PrevGravAction = GravAction
  3440. Calculate()
  3441. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement