Advertisement
cat568

Untitled

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