Advertisement
EARTHWORM_SALLY

Untitled

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