Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86. local player = owner
  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 = 10000
  137. local maxstamina = 10000
  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 = 5
  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 = 5
  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 = 5
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement