Advertisement
PasterXIV

Untitled

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