Advertisement
cat568

test 6

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