Advertisement
KHSora455

Derpy Running

Mar 7th, 2015
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.02 KB | None | 0 0
  1. print'why steal credit when you know it\'s mine?'
  2. --print'madiik cannot be resisted kthx'
  3.  
  4. function clerp(c1,c2,al)
  5. local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
  6. local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
  7. for i,v in pairs(com1) do
  8. com1[i] = v+(com2[i]-v)*al
  9. end
  10. return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
  11. end
  12.  
  13.  
  14. plr = game:service'Players'.LocalPlayer
  15. plrgui = plr.PlayerGui
  16. char = plr.Character
  17. mouse = plr:GetMouse()
  18. humanoid = char:findFirstChild("Humanoid")
  19. torso = char:findFirstChild("Torso")
  20. head = char.Head
  21. ra = char:findFirstChild("Right Arm")
  22. la = char:findFirstChild("Left Arm")
  23. rl = char:findFirstChild("Right Leg")
  24. ll = char:findFirstChild("Left Leg")
  25. rs = torso:findFirstChild("Right Shoulder")
  26. ls = torso:findFirstChild("Left Shoulder")
  27. rh = torso:findFirstChild("Right Hip")
  28. lh = torso:findFirstChild("Left Hip")
  29. neck = torso:findFirstChild("Neck")
  30. rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
  31. rootpart = char:findFirstChild("HumanoidRootPart")
  32. camera = workspace.CurrentCamera
  33. anim = char:findFirstChild("Animate")
  34. if anim then
  35. anim:Destroy()
  36. end
  37.  
  38. wait(1)
  39.  
  40. local rm = Instance.new("Motor", torso)
  41. rm.C0 = CFrame.new(1.5, 0.5, 0)
  42. rm.C1 = CFrame.new(0, 0.5, 0)
  43. rm.Part0 = torso
  44. rm.Part1 = ra
  45. rm.Name = 'Right Shoulder'
  46.  
  47. local lm = Instance.new("Motor", torso)
  48. lm.C0 = CFrame.new(-1.5, 0.5, 0)
  49. lm.C1 = CFrame.new(0, 0.5, 0)
  50. lm.Part0 = torso
  51. lm.Part1 = la
  52. lm.Name = 'Left Shoulder'
  53.  
  54. local rlegm = Instance.new("Motor", torso)
  55. rlegm.C0 = CFrame.new(0.5, -1, 0)
  56. rlegm.C1 = CFrame.new(0, 1, 0)
  57. rlegm.Part0 = torso
  58. rlegm.Part1 = rl
  59. local llegm = Instance.new("Motor", torso)
  60. llegm.C0 = CFrame.new(-0.5, -1, 0)
  61. llegm.C1 = CFrame.new(0, 1, 0)
  62. llegm.Part0 = torso
  63. llegm.Part1 = ll
  64.  
  65. rj.C0 = CFrame.new()
  66. rj.C1 = CFrame.new()
  67.  
  68. neck.C0 = CFrame.new(0, 1, 0)
  69. neck.C1 = CFrame.new(0, -0.5, 0)
  70.  
  71. local speed = 0.3
  72. local angle = 0
  73. local anglespeed = 1
  74. rsc0 = rm.C0
  75. lsc0 = lm.C0
  76. llc0 = llegm.C0
  77. rlc0 = rlegm.C0
  78. rootc0 = rj.C0
  79. neckc0 = neck.C0
  80.  
  81. mouse.KeyDown:connect(function(k)
  82. if k == "e" then
  83. fieryhead = not fieryhead
  84. if fieryhead then
  85. coroutine.wrap(function()
  86. while fieryhead and wait() do
  87. local FireColors = {'Really red', 'Really black'}
  88. local p = Instance.new('Part', char)
  89. p.BrickColor = BrickColor.new(FireColors[math.random(1,#FireColors)])
  90. p.FormFactor = 'Custom'
  91. p.Size = Vector3.new(3, 3, 3)
  92. p.CanCollide = false
  93. p.Anchored = true
  94. p.Locked = true
  95. Instance.new('PointLight', p).Range = 10
  96. p.CFrame = head.CFrame * CFrame.new(0, 1, 0) * CFrame.Angles(math.random(0,3),math.random(0,3),math.random(0,3))
  97. Instance.new('BlockMesh', p)
  98. coroutine.wrap(function()
  99. for i = 1, 10 do
  100. p.Mesh.Scale = p.Mesh.Scale - Vector3.new(.1, .1, .1)
  101. p.CFrame = p.CFrame * CFrame.new(0, .35, 0)
  102. wait()
  103. end
  104. end)()
  105. game:service'Debris':AddItem(p, .55)
  106. end
  107. end)()
  108. end
  109. end
  110. if k == "r" then
  111. if Charge1Anim or Attack1Anim then return end
  112. Charge1Anim = true
  113. for i = 0, 70 do
  114. local FireColors = {'Really red', 'Really black'}
  115. local p = Instance.new('Part', char)
  116. p.BrickColor = BrickColor.new(FireColors[math.random(1,#FireColors)])
  117. p.FormFactor = 'Custom'
  118. p.Size = Vector3.new(.8, .8, .8)
  119. p.CanCollide = false
  120. p.Anchored = true
  121. p.Locked = true
  122. p.CFrame = ra.CFrame * CFrame.new(0, -1, 0) * CFrame.Angles(math.random(0,3),math.random(0,3),math.random(0,3))
  123. Instance.new('BlockMesh', p)
  124. coroutine.wrap(function()
  125. for i = 1, 10 do
  126. p.Mesh.Scale = p.Mesh.Scale - Vector3.new(.1, .1, .1)
  127. p.CFrame = p.CFrame * CFrame.new(0, .15, 0)
  128. wait()
  129. end
  130. end)()
  131. game:service'Debris':AddItem(p, 2)
  132. wait()
  133. end
  134. Charge1Anim = false
  135. Attack1Anim = true
  136. wait(.35)
  137. local ray = Ray.new(ra.CFrame*CFrame.new(0,-1,0).p, ra.CFrame*CFrame.new(0, -150, 0).p)
  138. local hitz, enz = workspace:FindPartOnRay(ray, char)
  139. local humanoid = hitz and hitz.Parent and hitz.Parent:findFirstChild("Humanoid")
  140. if humanoid then
  141. humanoid:TakeDamage(80)
  142. end
  143. local humanoid = hitz and hitz.Parent and hitz.Parent.Parent and hitz.Parent.Parent:findFirstChild("Humanoid")
  144. if humanoid then
  145. humanoid:TakeDamage(80)
  146. end
  147.  
  148. --draw the ray
  149. local distance = (enz - ra.CFrame*CFrame.new(0,-1,0).p).magnitude
  150. local rayPart = Instance.new("Part", char)
  151. rayPart.BrickColor = BrickColor.new("Bright red")
  152. rayPart.Anchored = true
  153. rayPart.CanCollide = false
  154. rayPart.Locked = true
  155. rayPart.TopSurface = 0
  156. rayPart.BottomSurface = 0
  157. rayPart.formFactor = 'Custom'
  158. Instance.new('CylinderMesh', rayPart)
  159. rayPart.Size = Vector3.new(1, distance, 1)
  160. rayPart.CFrame = CFrame.new((enz + ra.CFrame*CFrame.new(0,-1,0).p)/2,enz) * CFrame.Angles(math.pi/2, 0, 0)
  161. for i = 0, 1, .1 do
  162. rayPart.Transparency = i
  163. wait()
  164. end
  165. rayPart:remove()
  166. Attack1Anim = false
  167. end
  168. if string.byte(k) == 48 then
  169. humanoid.WalkSpeed = 24
  170. end
  171. end)
  172.  
  173. mouse.KeyUp:connect(function(k)
  174. if string.byte(k) == 48 then
  175. humanoid.WalkSpeed = 16
  176. end
  177. end)
  178.  
  179. local action = 'None'
  180. plr.Chatted:connect(function(msg)
  181. if msg == '/e dance' or msg == '/emote dance' then
  182. action = 'Dance'
  183. end
  184. if msg == '/e bernie' or msg == '/emote bernie' then
  185. action = 'MovingLikeBernie'
  186. end
  187. end)
  188.  
  189. local dance_move_wait = 0
  190. print'madiik cannot be resisted kthx'
  191. game:service'RunService'.RenderStepped:connect(function()
  192. rm.MaxVelocity = 0
  193. lm.MaxVelocity = 0
  194. rm.DesiredAngle = 0
  195. rm.CurrentAngle = 0
  196. lm.DesiredAngle = 0
  197. lm.CurrentAngle = 0
  198. angle = (angle % 100) + anglespeed/10
  199. mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10))
  200. local rscf = rsc0
  201. local lscf = lsc0
  202. local rlcf = rlc0
  203. local llcf = llc0
  204. local rjcf = rootc0
  205. local ncf = neckc0
  206. local ray = Ray.new(rootpart.Position, Vector3.new(0, -4.1, 0))
  207. local hitz, enz = workspace:FindPartOnRay(ray, char)
  208. for i,object in pairs(char:children()) do
  209. if object:IsA("Tool") then
  210. tool = true
  211. if not debounce then
  212. for x,value in pairs(object:children()) do
  213. if value:IsA("StringValue") and value.Name == "toolanim" and value.Value == "Slash" then
  214. debounce = true
  215. coroutine.wrap(function()
  216. slashing = true
  217. wait(.15)
  218. slashing = false
  219. debounce = false
  220. end)()
  221. value:Destroy()
  222. end
  223. end
  224. end
  225. elseif not object:IsA'Tool' then
  226. tool = false
  227. end
  228. end
  229. if action == 'Dance' then
  230. anglespeed = 2
  231. if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then
  232. rjcf = rootc0 * CFrame.Angles(math.rad(2), math.sin(angle)*.15, 0)
  233. lscf = lsc0 * CFrame.new(0, .5 + math.sin(angle)*0.025, 0) * CFrame.Angles(math.pi/1.2-math.cos(angle)*0.4, math.sin(angle)*0.1, -.15 - -math.sin(angle)*0.4)
  234. rscf = rsc0 * CFrame.new(0, .5 + math.sin(angle)*0.025, 0) * CFrame.Angles(math.pi/1.2+math.cos(angle)*0.4, math.sin(-angle)*0.1, .15 + -math.sin(angle)*0.4)
  235. rlcf = rlc0 * CFrame.new(0, .3 + math.cos(angle)*.3, -.1) * CFrame.Angles(-math.rad(2), 0, 0)
  236. llcf = llc0 * CFrame.new(0, .3 - math.cos(angle)*.3, -.1) * CFrame.Angles(-math.rad(2), 0, 0)
  237. ncf = neckc0 * CFrame.Angles(0, math.sin(angle)*.4, 0)
  238. else
  239. action = 'None'
  240. end
  241. elseif action == 'MovingLikeBernie' then
  242. anglespeed = 1+math.random()
  243. dance_move_wait = (dance_move_wait%40) + 1/60
  244. if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then
  245. if dance_move_wait <= 20 then
  246. rjcf = rootc0 * CFrame.new(0, -.2, .6) * CFrame.Angles(math.rad(25)-math.sin(angle)*0.025, math.cos(angle)*.15, 0)
  247. lscf = lsc0 * CFrame.new(0, math.sin(angle)*0.025, 0) * CFrame.Angles(-math.pi/6 + -math.cos(angle)*0.4, math.sin(angle)*0.1, -.15 - -math.sin(angle)*0.4)
  248. rscf = rsc0 * CFrame.new(0, math.sin(angle)*0.025, 0) * CFrame.Angles(-math.pi/6 + math.cos(angle)*0.4, math.sin(-angle)*0.1, .15 + -math.sin(angle)*0.4)
  249. rlcf = rlc0 * CFrame.new(0, 0, -.1) * CFrame.Angles(-math.rad(25)+math.sin(angle)*0.025, -math.cos(angle)*.15, .1)
  250. llcf = llc0 * CFrame.new(0, 0, -.1) * CFrame.Angles(-math.rad(25)+math.sin(angle)*0.025, -math.cos(angle)*.15, -.1)
  251. ncf = neckc0 * CFrame.Angles(0, math.sin(angle)*.4, 0)
  252. elseif dance_move_wait > 20 then
  253. rjcf = rootc0 * CFrame.new(0, -.2, -.6) * CFrame.Angles(-math.rad(25)-math.sin(angle)*0.025, math.cos(angle)*.15, 0)
  254. lscf = lsc0 * CFrame.new(0, math.sin(angle)*0.025, 0) * CFrame.Angles(math.pi/6 + math.cos(angle)*0.4, math.sin(angle)*0.1, -.15 - -math.sin(angle)*0.4)
  255. rscf = rsc0 * CFrame.new(0, math.sin(angle)*0.025, 0) * CFrame.Angles(math.pi/6 + -math.cos(angle)*0.4, math.sin(-angle)*0.1, .15 + -math.sin(angle)*0.4)
  256. rlcf = rlc0 * CFrame.new(0, 0, -.1) * CFrame.Angles(math.rad(25)-math.sin(angle)*0.025, -math.cos(angle)*.15, .1)
  257. llcf = llc0 * CFrame.new(0, 0, -.1) * CFrame.Angles(math.rad(25)-math.sin(angle)*0.025, -math.cos(angle)*.15, -.1)
  258. ncf = neckc0 * CFrame.Angles(0, math.sin(angle)*.4, 0)
  259. end
  260. else
  261. action = 'None'
  262. end
  263. elseif not hitz and (torso.Velocity.y > 1 or torso.Velocity.y < -1) then
  264. anglespeed = 3
  265. rjcf = rootc0 * CFrame.Angles(math.rad(5), 0, 0)
  266. rscf = rsc0 * CFrame.Angles(math.rad(130) + math.sin(angle)*.8, 0, .15)
  267. lscf = lsc0 * CFrame.Angles(math.rad(130) + -math.sin(angle)*.8, 0, -.15)
  268. rlcf = rlc0 * CFrame.new(0, .3 + -math.cos(angle)*.3, -.3 + -math.cos(angle)*.3) * CFrame.Angles(math.pi/14 + -math.sin(angle)*1, 0, 0)
  269. llcf = llc0 * CFrame.new(0, .3 - -math.cos(angle)*.3, -.3 - -math.cos(angle)*.3) * CFrame.Angles(math.pi/14 + math.sin(angle)*1, 0, 0)
  270. ncf = neckc0 * CFrame.Angles(0, math.sin(angle)*.8, 0)
  271. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then
  272. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 20 then
  273. anglespeed = 2
  274. rjcf = rootc0 * CFrame.new(0, math.abs(math.sin(angle))*.65, 0) * CFrame.Angles(math.rad(10)+math.rad(torso.Velocity.y)*2, 0, 0)
  275. rscf = rsc0 * CFrame.Angles(math.sin(angle)*1.7, 0, .05)
  276. lscf = lsc0 * CFrame.Angles(-math.sin(angle)*1.7, 0, -.05)
  277. rlcf = rlc0 * CFrame.Angles(-math.sin(angle)*1.4, 0, 0)
  278. llcf = llc0 * CFrame.Angles(math.sin(angle)*1.4, 0, 0)
  279. ncf = neckc0 * CFrame.Angles(-math.rad(30) + math.abs(math.sin(angle))*.95, math.sin(angle)*.8, 0)
  280. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude > 20 then
  281. anglespeed = 2.5
  282. rjcf = rootc0 * CFrame.new(0, -.3 + math.abs(math.sin(angle))*.65, 0) * CFrame.Angles(-math.rad(10)+math.rad(torso.Velocity.y)*2, 0, 0)
  283. rscf = rsc0 * CFrame.new(0, math.cos(angle)*.5, math.sin(angle)*.5) * CFrame.Angles(math.cos(angle)*2.8, 0, math.abs(math.sin(angle))*.5)
  284. lscf = lsc0 * CFrame.new(0, -math.cos(angle)*.5, -math.sin(angle)*.5) * CFrame.Angles(-math.cos(angle)*2.8, 0, -math.abs(math.sin(angle))*.5)
  285. rlcf = rlc0 * CFrame.new(0, .3 + -math.cos(-angle)*.3, -.2+math.sin(angle)*0.25) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.4, 0, math.rad(.5))
  286. llcf = llc0 * CFrame.new(0, .3 - -math.cos(angle)*.3, -.05-math.sin(angle)*0.25) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.4, 0, -math.rad(.5))
  287. ncf = neckc0 * CFrame.Angles(math.cos(angle), math.sin(angle), 0)
  288. end
  289. if Charge1Anim then
  290. rscf = rsc0 * CFrame.new(-.75, 0, .75) * CFrame.Angles(math.pi/4, 0, math.pi/4)
  291. lscf = lsc0 * CFrame.new(.95, 0, -.45) * CFrame.Angles(math.pi/4, 0, math.pi/3)
  292. end
  293. if Attack1Anim then
  294. rscf = rsc0 * CFrame.Angles(math.pi/2, 0, 0)
  295. lscf = lsc0 * CFrame.Angles(-math.pi/8, 0, 0)
  296. end
  297. if tool then
  298. rscf = rsc0 * CFrame.Angles(math.pi/2, 0, 0)
  299. if slashing then
  300. rscf = rsc0 * CFrame.Angles(-math.pi/12, 0, -.1)
  301. end
  302. end
  303. rm.C0 = clerp(rm.C0,rscf,speed)
  304. lm.C0 = clerp(lm.C0,lscf,speed)
  305. rj.C0 = clerp(rj.C0,rjcf,speed)
  306. neck.C0 = clerp(neck.C0,ncf,speed)
  307. rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  308. llegm.C0 = clerp(llegm.C0,llcf,speed)
  309. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement