Advertisement
Mediakiller7Cool

asdasd8

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