Advertisement
icy-desudesu

jimmy mew

Aug 3rd, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.69 KB | None | 0 0
  1. --This is just a fun script. Make it local to work, have fun. --
  2. do --CFrame lerp
  3. local function QuaternionFromCFrame(cf)
  4. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  5. local trace = m00 + m11 + m22
  6. if trace > 0 then
  7. local s = math.sqrt(1 + trace)
  8. local recip = 0.5/s
  9. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  10. else
  11. local i = 0
  12. if m11 > m00 then
  13. i = 1
  14. end
  15. if m22 > (i == 0 and m00 or m11) then
  16. i = 2
  17. end
  18. if i == 0 then
  19. local s = math.sqrt(m00-m11-m22+1)
  20. local recip = 0.5/s
  21. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  22. elseif i == 1 then
  23. local s = math.sqrt(m11-m22-m00+1)
  24. local recip = 0.5/s
  25. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  26. elseif i == 2 then
  27. local s = math.sqrt(m22-m00-m11+1)
  28. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  29. end
  30. end
  31. end
  32. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  33. local xs, ys, zs = x + x, y + y, z + z
  34. local wx, wy, wz = w*xs, w*ys, w*zs
  35. local xx = x*xs
  36. local xy = x*ys
  37. local xz = x*zs
  38. local yy = y*ys
  39. local yz = y*zs
  40. local zz = z*zs
  41. return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  42. end
  43. local function QuaternionSlerp(a, b, t)
  44. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  45. local startInterp, finishInterp;
  46. if cosTheta >= 0.0001 then
  47. if (1 - cosTheta) > 0.0001 then
  48. local theta = math.acos(cosTheta)
  49. local invSinTheta = 1/math.sin(theta)
  50. startInterp = math.sin((1-t)*theta)*invSinTheta
  51. finishInterp = math.sin(t*theta)*invSinTheta
  52. else
  53. startInterp = 1-t
  54. finishInterp = t
  55. end
  56. else
  57. if (1+cosTheta) > 0.0001 then
  58. local theta = math.acos(-cosTheta)
  59. local invSinTheta = 1/math.sin(theta)
  60. startInterp = math.sin((t-1)*theta)*invSinTheta
  61. finishInterp = math.sin(t*theta)*invSinTheta
  62. else
  63. startInterp = t-1
  64. finishInterp = t
  65. end
  66. end
  67. return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  68. end
  69. function clerp(a,b,t)
  70. local qa = {QuaternionFromCFrame(a)}
  71. local qb = {QuaternionFromCFrame(b)}
  72. local ax, ay, az = a.x, a.y, a.z
  73. local bx, by, bz = b.x, b.y, b.z
  74. local _t = 1-t
  75. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  76. end
  77.  
  78. end
  79. do --the animating
  80. plr = game:service'Players'.LocalPlayer
  81. char = plr.Character
  82. mouse = plr:GetMouse()
  83. humanoid = char:findFirstChild("Humanoid")
  84. torso = char:findFirstChild("Torso")
  85. head = char.Head
  86. ra = char:findFirstChild("Right Arm")
  87. la = char:findFirstChild("Left Arm")
  88. rl = char:findFirstChild("Right Leg")
  89. ll = char:findFirstChild("Left Leg")
  90. rs = torso:findFirstChild("Right Shoulder")
  91. ls = torso:findFirstChild("Left Shoulder")
  92. rh = torso:findFirstChild("Right Hip")
  93. lh = torso:findFirstChild("Left Hip")
  94. neck = torso:findFirstChild("Neck")
  95. rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
  96. anim = char:findFirstChild("Animate")
  97. rootpart = char:findFirstChild("HumanoidRootPart")
  98. camera = workspace.CurrentCamera
  99. if anim then
  100. anim:Destroy()
  101. end
  102.  
  103.  
  104. local rm = Instance.new("Motor", torso)
  105. rm.C0 = CFrame.new(1.5, 0.5, 0)
  106. rm.C1 = CFrame.new(0, 0.5, 0)
  107. rm.Part0 = torso
  108. rm.Part1 = ra
  109. local lm = Instance.new("Motor", torso)
  110. lm.C0 = CFrame.new(-1.5, 0.5, 0)
  111. lm.C1 = CFrame.new(0, 0.5, 0)
  112. lm.Part0 = torso
  113. lm.Part1 = la
  114.  
  115. local rlegm = Instance.new("Motor", torso)
  116. rlegm.C0 = CFrame.new(0.5, -1, 0)
  117. rlegm.C1 = CFrame.new(0, 1, 0)
  118. rlegm.Part0 = torso
  119. rlegm.Part1 = rl
  120. local llegm = Instance.new("Motor", torso)
  121. llegm.C0 = CFrame.new(-0.5, -1, 0)
  122. llegm.C1 = CFrame.new(0, 1, 0)
  123. llegm.Part0 = torso
  124. llegm.Part1 = ll
  125.  
  126. neck.C0 = CFrame.new(0, 1, 0)
  127. neck.C1 = CFrame.new(0, -0.5, 0)
  128.  
  129.  
  130. rj.C0 = CFrame.new()
  131. rj.C1 = CFrame.new()
  132.  
  133.  
  134. local sound = Instance.new("Sound", head)
  135. sound.SoundId = "http://www.roblox.com/asset/?id=130797915"
  136. sound.Volume = 0.8
  137. sound.Looped = true
  138.  
  139.  
  140.  
  141. --look of the fox here
  142. game:service'InsertService':LoadAsset(1374269):children()[1].Parent = char
  143. Instance.new("PointLight", head).Range = 10
  144.  
  145.  
  146.  
  147.  
  148. local speed = 0.3
  149. local angle = 0
  150. local sitting = false
  151. local humanwalk = false
  152. local anglespeed = 1
  153. rsc0 = rm.C0
  154. lsc0 = lm.C0
  155. llc0 = llegm.C0
  156. rlc0 = rlegm.C0
  157. neckc0 = neck.C0
  158.  
  159. local controllerService = game:GetService("ControllerService")
  160. local controller = controllerService:GetChildren()[1]
  161.  
  162. controller.Parent = nil
  163.  
  164. Instance.new("HumanoidController", game:service'ControllerService')
  165. Instance.new("SkateboardController", game:service'ControllerService')
  166. Instance.new("VehicleController", game:service'ControllerService')
  167. local controller = controllerService:GetChildren()[1]
  168. mouse.KeyDown:connect(function(k)
  169. if k == "q" then
  170. humanwalk = not humanwalk
  171. end
  172. if k == "z" then
  173. if not sound.IsPlaying then
  174. sound:stop()
  175. sound.SoundId = "http://www.roblox.com/asset/?id=175706188"
  176. wait()
  177. sound:play()
  178. end
  179. end
  180. if k == "x" then
  181. if not sound.IsPlaying then
  182. sound:stop()
  183. sound.SoundId = "http://www.roblox.com/asset/?id=452907108"
  184. wait()
  185. sound:play()
  186. end
  187. end
  188. if k == "c" then
  189. if not sound.IsPlaying then
  190. sound:stop()
  191. sound.SoundId = "http://www.roblox.com/asset/?id=147746074"
  192. wait()
  193. sound:play()
  194. end
  195. end
  196. if string.byte(k) == 48 then
  197. humanoid.WalkSpeed = 34
  198. end
  199.  
  200. end)
  201. mouse.KeyUp:connect(function(k)
  202.  
  203. if string.byte(k) == 48 then
  204. humanoid.WalkSpeed = 16
  205. end
  206.  
  207. end)
  208.  
  209.  
  210.  
  211. while wait() do
  212. angle = (angle % 100) + anglespeed/10
  213. mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10))
  214. local rscf = rsc0
  215. local lscf = lsc0
  216. local rlcf = rlc0
  217. local llcf = llc0
  218. local rjcf = CFrame.new()
  219. local ncf = neckc0
  220. local rayz = Ray.new(rootpart.Position, Vector3.new(0, -6, 0))
  221. local hitz, enz = workspace:findPartOnRay(rayz, char)
  222. if not hitz then
  223. if sound.IsPlaying then
  224. sound:stop()
  225. end
  226.  
  227. if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude > 2 then
  228.  
  229. ncf = neckc0 * CFrame.Angles(math.pi/5, 0, 0)
  230. rjcf = CFrame.new() * CFrame.Angles(-math.pi/5, math.sin(angle)*0.05, 0)
  231. rscf = rsc0 * CFrame.Angles(math.pi/1.7+math.sin(angle)*0.1, 0, 0)
  232. lscf = lsc0 * CFrame.Angles(math.pi/1.7+math.sin(-angle)*0.1, 0, 0)
  233. rlcf = rlc0 * CFrame.Angles(-math.pi/10+math.sin(-angle)*0.3, 0, 0)
  234. llcf = llc0 * CFrame.Angles(-math.pi/10+math.sin(angle)*0.3, 0, 0)
  235.  
  236. else
  237.  
  238. ncf = neckc0 * CFrame.Angles(math.pi/14, 0, 0)
  239. rjcf = CFrame.new() * CFrame.Angles(-math.pi/18, math.sin(angle)*0.05, 0)
  240. rscf = rsc0 * CFrame.Angles(-math.pi/10+math.sin(angle)*0.2, 0, 0)
  241. lscf = lsc0 * CFrame.Angles(-math.pi/10+math.sin(-angle)*0.2, 0, 0)
  242. rlcf = rlc0 * CFrame.new(0, 0.7, -0.5) CFrame.Angles(-math.pi/14, 0, 0)
  243. llcf = llc0 * CFrame.Angles(-math.pi/20, 0, 0)
  244.  
  245. end
  246. elseif humanoid.Sit then
  247. if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=175706188" then
  248. anglespeed = 6
  249. ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0)
  250. rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
  251. rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  252. lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  253. rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  254. llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  255. elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=452907108" then
  256. anglespeed = 4
  257. ncf = neckc0 * CFrame.Angles(math.pi/5-math.abs(math.sin(angle))*0.3, 0, 0)
  258. rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
  259. rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  260. lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  261. rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  262. llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  263. elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=147746074" then
  264. anglespeed = 2
  265. ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
  266. rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
  267. rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  268. lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  269. rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  270. llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  271. else
  272. anglespeed = 1/2
  273. ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
  274. rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
  275. rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  276. lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  277. rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  278. llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  279. end
  280. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then
  281. if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130797915" then
  282. anglespeed = 6
  283. ncf = neckc0 * CFrame.Angles(math.pi/10-math.sin(angle)*0.07, 0, 0)
  284. rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/10, math.sin(angle)*0.001, 0)
  285. rscf = rsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*0.5, 0, 0)
  286. lscf = lsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*0.5, 0, 0)
  287. rlcf = rlc0 * CFrame.Angles(math.pi/10, math.sin(angle)*0.08, math.rad(6.5))
  288. llcf = llc0 * CFrame.Angles(math.pi/10, -math.sin(angle)*0.08, -math.rad(6.5))
  289. elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149713968" then
  290. anglespeed = 2
  291. ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.3, 0, 0)
  292. rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/20, math.sin(angle)*0.001, 0)
  293. rscf = rsc0 * CFrame.Angles(math.pi/2+math.abs(math.sin(angle)*1), 0, 0)
  294. lscf = lsc0 * CFrame.Angles(math.pi/2+math.abs(math.sin(angle)*1), 0, 0)
  295. rlcf = rlc0 * CFrame.Angles(math.pi/20, math.sin(angle)*0.08, math.rad(2.5))
  296. llcf = llc0 * CFrame.Angles(math.pi/20, -math.sin(angle)*0.08, -math.rad(2.5))
  297. elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130802245" then
  298. anglespeed = 3
  299. ncf = neckc0 * CFrame.Angles(math.sin(angle)*0.07, math.rad(30), 0)
  300. rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0)
  301. rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.05, 0, 0)
  302. lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.05, 0, 0)
  303. rlcf = rlc0 * CFrame.new(0, -0.1 + math.abs(mvmnt)*0.1, -0.1) * CFrame.Angles(0, math.rad(5), math.rad(5))
  304. llcf = llc0 * CFrame.Angles(0, math.rad(2.5), math.rad(1))
  305. else
  306. if humanwalk then
  307. anglespeed = 1/4
  308. ncf = neckc0 * CFrame.Angles(-math.sin(angle)*0.07, 0, 0)
  309. rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0)
  310. rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.1, 0, 0)
  311. lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.1, 0, 0)
  312. rlcf = rlc0 * CFrame.Angles(0, math.sin(angle)*0.08, math.rad(2.5))
  313. llcf = llc0 * CFrame.Angles(0, -math.sin(angle)*0.08, -math.rad(2.5))
  314. else
  315. anglespeed = 1/2
  316. ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
  317. rjcf = CFrame.new(0, -2, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
  318. rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  319. lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  320. rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  321. llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  322. end
  323. end
  324. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 20 then
  325. if sound.IsPlaying then
  326. sound:stop()
  327. end
  328. if humanwalk then
  329. anglespeed = 4
  330. ncf = neckc0 * CFrame.Angles(math.pi/24, mvmnt*.02, 0)
  331. rjcf = CFrame.new(0, math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/24, -mvmnt*.02, 0)
  332. rscf = rsc0 * CFrame.Angles(math.sin(angle)*1.25, 0, -math.abs(mvmnt)*0.02)
  333. lscf = lsc0 * CFrame.Angles(math.sin(-angle)*1.25, 0, math.abs(mvmnt)*0.02)
  334. rlcf = rlc0 * CFrame.Angles(math.sin(-angle)*1, 0, math.rad(.5))
  335. llcf = llc0 * CFrame.Angles(math.sin(angle)*1, 0, -math.rad(.5))
  336. else
  337. anglespeed = 4
  338. ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9, 0, 0)
  339. rjcf = CFrame.new(0, -1.5+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9, math.sin(mvmnt/2)*0.05, 0)
  340. rscf = rsc0 * CFrame.new(-.45, 0.2, -.4+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(angle)*0.7, 0, math.rad(5))
  341. lscf = lsc0 * CFrame.new(.45, 0.2, .1-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(-angle)*0.7, 0, -math.rad(5))
  342. rlcf = rlc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*0.6, 0, math.abs(mvmnt)*0.025)
  343. llcf = llc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(angle)*.6, 0, -math.abs(mvmnt)*0.025)
  344. end
  345. elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then
  346. if sound.IsPlaying then
  347. sound:stop()
  348. end
  349. if humanwalk then
  350. anglespeed = 5
  351. ncf = neckc0 * CFrame.Angles(math.pi/20, math.sin(angle)*.04, 0)
  352. rjcf = CFrame.new(0, -.4 + math.abs(mvmnt)*0.25, 0) * CFrame.Angles(-math.pi/20, -math.sin(angle)*.08, 0)
  353. rscf = rsc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/18+math.sin(angle)*1.5, 0, -math.abs(mvmnt)*0.02)
  354. lscf = lsc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/18+math.sin(-angle)*1.5, 0, math.abs(mvmnt)*0.02)
  355. rlcf = rlc0 * CFrame.new(0, 0, -.6+math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.3, 0, math.rad(.5))
  356. llcf = llc0 * CFrame.new(0, 0, -math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.3, 0, -math.rad(.5))
  357. else
  358. anglespeed = 5.5
  359. ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9+math.sin(mvmnt/2)*0.05, 0, 0)
  360. rjcf = CFrame.new(0, -1.3+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9+math.abs(mvmnt/2)*0.1, 0, 0)
  361. rscf = rsc0 * CFrame.new(-1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, math.rad(5))
  362. lscf = lsc0 * CFrame.new(1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, -math.rad(5))
  363. rlcf = rlc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, math.abs(mvmnt)*0.025)
  364. llcf = llc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, -math.abs(mvmnt)*0.025)
  365. end
  366. end
  367.  
  368. rm.C0 = clerp(rm.C0,rscf,speed)
  369. lm.C0 = clerp(lm.C0,lscf,speed)
  370. rj.C0 = clerp(rj.C0,rjcf,speed)
  371. neck.C0 = clerp(neck.C0,ncf,speed)
  372. rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  373. llegm.C0 = clerp(llegm.C0,llcf,speed)
  374. end
  375.  
  376.  
  377. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement