Totek2007

Parkour

Jul 28th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.97 KB | None | 0 0
  1. --Saved at 1:09 AM
  2. local ran,err = ypcall(function()
  3. plr = game:service'Players'.LocalPlayer
  4. char = plr.Character
  5. mouse = plr:GetMouse()
  6. humanoid = char:findFirstChild("Humanoid")
  7. torso = char:findFirstChild("Torso")
  8. head = char.Head
  9. ra = char:findFirstChild("Right Arm")
  10. la = char:findFirstChild("Left Arm")
  11. rl = char:findFirstChild("Right Leg")
  12. ll = char:findFirstChild("Left Leg")
  13. rs = torso:findFirstChild("Right Shoulder")
  14. ls = torso:findFirstChild("Left Shoulder")
  15. rh = torso:findFirstChild("Right Hip")
  16. lh = torso:findFirstChild("Left Hip")
  17. neck = torso:findFirstChild("Neck")
  18. rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
  19. anim = char:findFirstChild("Animate")
  20. rootpart = char:findFirstChild("HumanoidRootPart")
  21. if anim then
  22. anim:Destroy()
  23. end
  24.  
  25. if char:findFirstChild(script.Name) then
  26. char:findFirstChild(script.Name):Destroy()
  27. end
  28.  
  29.  
  30.  
  31.  
  32. --create func
  33. function part(parent, size, color, formfactor, collide, transparency)
  34. if transparency == nil then transparency=0 end
  35. if collide == nil then collide=false end
  36. if formfactor == nil then formfactor=Enum.FormFactor.Custom end
  37. local p = Instance.new("Part", parent)
  38. p.FormFactor = formfactor
  39. p.CanCollide = false
  40. p.Size = size
  41. p.Locked = true
  42. p.Transparency = transparency
  43. p.Position = torso.Position
  44. p.BrickColor = color
  45. p.FrontSurface = "SmoothNoOutlines"
  46. p.BackSurface = "SmoothNoOutlines"
  47. p.LeftSurface = "SmoothNoOutlines"
  48. p.BottomSurface = "SmoothNoOutlines"
  49. p.TopSurface = "SmoothNoOutlines"
  50. p.RightSurface = "SmoothNoOutlines"
  51. return p
  52. end
  53. function wedge(parent, size, color, formfactor, collide, transparency)
  54.  
  55. if transparency==nil then transparency=0 end
  56. if collide==nil then collide=false end
  57. if formfactor==nil then formfactor="Custom" end
  58.  
  59. local p = Instance.new("WedgePart", parent)
  60. p.FormFactor = formfactor
  61. p.CanCollide = false
  62. p.Size = size
  63. p.Locked = true
  64. p.Position = torso.Position
  65. p.BrickColor = color
  66. p.FrontSurface = "SmoothNoOutlines"
  67. p.BackSurface = "SmoothNoOutlines"
  68. p.LeftSurface = "SmoothNoOutlines"
  69. p.BottomSurface = "SmoothNoOutlines"
  70. p.TopSurface = "SmoothNoOutlines"
  71. p.RightSurface = "SmoothNoOutlines"
  72. return p
  73. end
  74. function weld(part0, part1, c0, parent, c1)
  75. if parent == nil then parent=char end
  76. if c1 == nil then c1=CFrame.new() end
  77.  
  78. local wel = Instance.new("Weld", parent)
  79. wel.Part0 = part0
  80. wel.Part1 = part1
  81. wel.C0 = c0
  82. wel.C1 = c1
  83. return wel
  84. end
  85. function specialmesh(parent, meshType, scale, meshId)
  86. if meshId==nil then meshId="" end
  87. local mesh = Instance.new("SpecialMesh", parent)
  88. mesh.Scale = scale
  89. mesh.MeshType = meshType
  90. mesh.MeshId = meshId
  91. return mesh
  92. end
  93. if char:findFirstChild("Shirt") then
  94. char:findFirstChild("Shirt"):Destroy()
  95. end
  96. if char:findFirstChild("Pants") then
  97. char:findFirstChild("Pants"):Destroy()
  98. end
  99. if char:findFirstChild("Body Colors") then
  100. char:findFirstChild("Body Colors"):Destroy()
  101. end
  102. wait()
  103. for i,v in pairs(char:children()) do
  104. if v:IsA("Hat") then
  105. v:Destroy()
  106. end
  107. if v:IsA("Part") then
  108. v.BrickColor = BrickColor.new(224)
  109. end
  110. end
  111. randomc = BrickColor.Random()
  112. --part(parent, size, color, formfactor(opt), collide(opt), transparency(opt))
  113. local rshldr = part(char, Vector3.new(1.03, 1.1, 1.03), randomc)
  114. local rwld = weld(rshldr, ra, CFrame.new(0, -.5, 0))
  115. local lshldr = part(char, Vector3.new(1.03, 1.1, 1.03), randomc)
  116. local lwld = weld(lshldr, la, CFrame.new(0, -.5, 0))
  117. local rshldr2 = part(char, Vector3.new(1.05, .2, 1.05), BrickColor.White())
  118. local rwld2 = weld(rshldr2, ra, CFrame.new(0, 0, 0))
  119. local lshldr2 = part(char, Vector3.new(1.05, .2, 1.05), BrickColor.White())
  120. local lwld2 = weld(lshldr2, la, CFrame.new(0, 0, 0))
  121. local trs = part(char, Vector3.new(2.03, 2.03, 1.03), randomc)
  122. local trsw = weld(trs, torso, CFrame.new(0, 0, 0))
  123. local trs2 = part(char, Vector3.new(2.05, .2, 1.05), BrickColor.White())
  124. local trs2w = weld(trs2, torso, CFrame.new(0, .95, 0))
  125. local lel = part(char, Vector3.new(1.015, 2.03, 1.015), BrickColor.Blue())
  126. local llw = weld(lel, ll, CFrame.new(0, 0, 0))
  127. local ril = part(char, Vector3.new(1.015, 2.03, 1.015), BrickColor.Blue())
  128. local rlw = weld(ril, rl, CFrame.new(0, 0, 0))
  129. local lel2 = part(char, Vector3.new(1.04, 0.3, 1.44), BrickColor.Gray())
  130. local llw2 = weld(lel2, ll, CFrame.new(0, .9, .2))
  131. local ril2 = part(char, Vector3.new(1.04, 0.3, 1.44), BrickColor.Gray())
  132. local rlw2 = weld(ril2, rl, CFrame.new(0, .9, .2))
  133.  
  134. local hat = part(char, Vector3.new(1.34, 0.5, 1.34), randomc)
  135. local hatw = weld(hat, head, CFrame.new(0, -.7, 0))
  136. local hat2 = part(char, Vector3.new(1.64, 0.2015, 1.94), randomc)
  137. local hatw2 = weld(hat2, head, CFrame.new(0, -.4, 0))
  138. local hat3 = part(char, Vector3.new(1.44, 0.2, 2.14), randomc)
  139. local hatw3 = weld(hat3, head, CFrame.new(0, -.4, 0))
  140.  
  141.  
  142. specialmesh(ra, "Brick", Vector3.new(1, 1, 1), "")
  143. specialmesh(la, "Brick", Vector3.new(1, 1, 1), "")
  144. specialmesh(rl, "Brick", Vector3.new(1, 1, 1), "")
  145. specialmesh(ll, "Brick", Vector3.new(1, 1, 1), "")
  146. specialmesh(head, "Brick", Vector3.new(0.62, 1.2, 1.2), "")
  147. specialmesh(torso, "Brick", Vector3.new(1, 1, 1), "")
  148.  
  149.  
  150.  
  151. local rm = Instance.new("Motor", torso)
  152. rm.C0 = CFrame.new(1.5, 0.5, 0)
  153. rm.C1 = CFrame.new(0, 0.5, 0)
  154. rm.Part0 = torso
  155. rm.Part1 = ra
  156. local lm = Instance.new("Motor", torso)
  157. lm.C0 = CFrame.new(-1.5, 0.5, 0)
  158. lm.C1 = CFrame.new(0, 0.5, 0)
  159. lm.Part0 = torso
  160. lm.Part1 = la
  161.  
  162. local rlegm = Instance.new("Motor", torso)
  163. rlegm.C0 = CFrame.new(0.5, -1, 0)
  164. rlegm.C1 = CFrame.new(0, 1, 0)
  165. rlegm.Part0 = torso
  166. rlegm.Part1 = rl
  167. local llegm = Instance.new("Motor", torso)
  168. llegm.C0 = CFrame.new(-0.5, -1, 0)
  169. llegm.C1 = CFrame.new(-0, 1, 0)
  170. llegm.Part0 = torso
  171. llegm.Part1 = ll
  172.  
  173. neck.C0 = CFrame.new(0, 1, 0)
  174. neck.C1 = CFrame.new(0, -0.5, 0)
  175.  
  176.  
  177. rj.C0 = CFrame.new()
  178. rj.C1 = CFrame.new()
  179.  
  180. local anim = ""
  181. local lastanim = anim
  182. local countspeed = 1
  183. local slidecount = 1
  184. local speed = 0
  185. local count = 0
  186. local slidecountmax = 0.001
  187. local rotation = 1
  188. local maxrotation = 0.001
  189. local bobbing = 0.001
  190. local maxbobbing = 0
  191.  
  192.  
  193. mouse.KeyDown:connect(function(k)
  194. if string.byte(k) == 48 then
  195. humanoid.WalkSpeed = 24
  196. end
  197. end)
  198. mouse.KeyUp:connect(function(k)
  199. if string.byte(k) == 52 then
  200. anim = "None"
  201. end
  202.  
  203. if string.byte(k) == 48 then
  204. humanoid.WalkSpeed = 16
  205. end
  206. end)
  207.  
  208. while wait() do
  209. count = (count % 100) + countspeed
  210. angle = math.pi * math.sin(math.pi*2/100*count)
  211. if slidecount < slidecountmax then
  212. slidecount = slidecount + speed
  213. end
  214. if slidecount > slidecountmax then
  215. slidecount = slidecount - speed
  216. end
  217. if rotation > maxrotation then
  218. rotation = rotation - rotation/12.5
  219. end
  220. if rotation < maxrotation then
  221. rotation = rotation + rotation/12.5
  222. end
  223.  
  224. if bobbing > maxbobbing then
  225. bobbing = bobbing - bobbing/5
  226. end
  227. if bobbing < maxbobbing then
  228. bobbing = bobbing + bobbing/5
  229. end
  230.  
  231.  
  232. local rayz = Ray.new(torso.Position, Vector3.new(0, -4.5, 0))
  233. local hitz, enz = workspace:findPartOnRay(rayz, char)
  234. if hitz == nil then
  235. anim = "Jumping"
  236. countspeed = 5
  237. rm.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.pi + -angle*rotation, 0,math.abs(angle*0.03))
  238. lm.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(-math.pi+ angle*rotation, 0,-math.abs(angle*0.03))
  239. rlegm.C0 = CFrame.new(0.5, -1 + math.abs(angle*0.02), 0) * CFrame.Angles(angle*rotation/4, 0, 0)
  240. llegm.C0 = CFrame.new(-0.5, -1 - -math.abs(angle*0.02), 0) * CFrame.Angles(-angle*rotation/4, 0, 0)
  241. neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(math.pi/8/5*slidecount, 0, 0)
  242. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then
  243. anim = "Idle"
  244. slidecountmax = 0
  245. countspeed = 1
  246. maxrotation = 0.05
  247. rm.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(slidecount) + -angle*rotation, 0,math.abs(angle*0.03))
  248. lm.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(math.rad(slidecount) + angle*rotation, 0,-math.abs(angle*0.03))
  249. rlegm.C0 = CFrame.new(0.5, -1, 0) * CFrame.Angles(angle*rotation/2, 0, 0)
  250. llegm.C0 = CFrame.new(-0.5, -1, 0) * CFrame.Angles(-angle*rotation/2, 0, 0)
  251. neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(0, 0, 0)
  252. rj.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
  253. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 18 then
  254. anim = "Walking"
  255. slidecountmax = 0
  256. maxrotation = 0.2
  257. countspeed = 6
  258. rm.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(slidecount) + -angle*rotation, 0,math.abs(angle*0.03))
  259. lm.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(math.rad(slidecount) + angle*rotation, 0,-math.abs(angle*0.03))
  260. rlegm.C0 = CFrame.new(0.5, -1, 0) * CFrame.Angles(angle*rotation, 0, 0)
  261. llegm.C0 = CFrame.new(-0.5, -1, 0) * CFrame.Angles(-angle*rotation, 0, 0)
  262. neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(0, 0, 0)
  263. rj.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
  264. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 18 then
  265. slidecountmax = 4
  266. speed = 0.5
  267. maxrotation = 0.45
  268. countspeed = 8
  269. rm.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(-angle*rotation, 0,math.abs(angle*0.03))
  270. lm.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(angle*rotation, 0,-math.abs(angle*0.03))
  271. rlegm.C0 = CFrame.new(0.5, -1, 0) * CFrame.Angles(angle*rotation, 0, 0)
  272. llegm.C0 = CFrame.new(-0.5, -1, 0) * CFrame.Angles(-angle*rotation, 0, 0)
  273. neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(math.pi/8/5*slidecount, 0, 0)
  274. rj.C0 = CFrame.new(0, math.abs(angle*.055), 0) * CFrame.Angles(-math.pi/8/5*slidecount, math.sin(angle*0.05), 0)
  275. --[[elseif anim == "Sliding" then
  276. print'work pls5'
  277. countspeed = 0.1
  278. print'k2'
  279. maxbobbing = 1.8
  280. print'asdf3'
  281. rm.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(-angle*rotation, 0,math.abs(angle*0.03))
  282. lm.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(angle*rotation, 0,-math.abs(angle*0.03))
  283. rlegm.C0 = CFrame.new(0.5, -1, 0) * CFrame.Angles(angle*rotation, 0, 0)
  284. llegm.C0 = CFrame.new(-0.5, -1, 0) * CFrame.Angles(-angle*rotation, 0, 0)
  285. neck.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(-math.rad(bobbing*49), 0, 0)
  286. rj.C0 = CFrame.new(0, bobbing, 0) * CFrame.Angles(math.rad(bobbing*49), 0, 0)]]
  287. end
  288. lastanim = anim
  289. end
  290. end)
  291. if not ran and err then
  292. print(err)
  293. end
Add Comment
Please, Sign In to add comment