Wweroblox12121212

Untitled

Jan 13th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. --credit: KrystalTeam
  2. local twerksrc = [[
  3. function clerp(a,b,t)
  4. local qa = {QuaternionFromCFrame(a)}
  5.  
  6. local qb = {QuaternionFromCFrame(b)}
  7.  
  8. local ax, ay, az = a.x, a.y, a.z
  9.  
  10. local bx, by, bz = b.x, b.y, b.z
  11.  
  12. local _t = 1-t
  13.  
  14. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  15. end
  16.  
  17. function QuaternionFromCFrame(cf)
  18. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  19.  
  20. local trace = m00 + m11 + m22
  21. if trace > 0 then
  22. local s = math.sqrt(1 + trace)
  23.  
  24. local recip = 0.5/s
  25.  
  26. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  27. else
  28. local i = 0
  29.  
  30. if m11 > m00 then
  31.  
  32. i = 1
  33.  
  34. end
  35. if m22 > (i == 0 and m00 or m11) then
  36.  
  37. i = 2
  38.  
  39. end
  40. if i == 0 then
  41. local s = math.sqrt(m00-m11-m22+1)
  42.  
  43. local recip = 0.5/s
  44.  
  45. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  46. elseif i == 1 then
  47. local s = math.sqrt(m11-m22-m00+1)
  48.  
  49. local recip = 0.5/s
  50.  
  51. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  52. elseif i == 2 then
  53. local s = math.sqrt(m22-m00-m11+1)
  54.  
  55. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  56. end
  57. end
  58. end
  59.  
  60. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  61. local xs, ys, zs = x + x, y + y, z + z
  62.  
  63. local wx, wy, wz = w*xs, w*ys, w*zs
  64.  
  65. local xx = x*xs
  66.  
  67. local xy = x*ys
  68.  
  69. local xz = x*zs
  70.  
  71. local yy = y*ys
  72.  
  73. local yz = y*zs
  74.  
  75. local zz = z*zs
  76.  
  77. 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))
  78. end
  79.  
  80. function QuaternionSlerp(a, b, t)
  81. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  82. local startInterp, finishInterp;
  83. if cosTheta >= 0.0001 then
  84. if (1 - cosTheta) > 0.0001 then
  85. local theta = math.acos(cosTheta)
  86.  
  87. local invSinTheta = 1/math.sin(theta)
  88.  
  89. startInterp = math.sin((1-t)*theta)*invSinTheta
  90.  
  91. finishInterp = math.sin(t*theta)*invSinTheta
  92. else
  93. startInterp = 1-t
  94.  
  95. finishInterp = t
  96. end
  97. else
  98. if (1+cosTheta) > 0.0001 then
  99. local theta = math.acos(-cosTheta)
  100. local invSinTheta = 1/math.sin(theta)
  101. startInterp = math.sin((t-1)*theta)*invSinTheta
  102. finishInterp = math.sin(t*theta)*invSinTheta
  103. else
  104. startInterp = t-1
  105.  
  106. finishInterp = t
  107. end
  108. end
  109. 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
  110. end
  111.  
  112. cf = CFrame.new
  113. euler = CFrame.fromEulerAnglesXYZ
  114.  
  115. Player=game:GetService("Players").LocalPlayer
  116. Character=Player.Character
  117. PlayerGui=Player.PlayerGui
  118. Backpack=Player.Backpack
  119. Torso=Character.Torso
  120. Head=Character.Head
  121. Hum1=Character.Hum1
  122. LeftArm=Character["Left Arm"]
  123. LeftLeg=Character["Left Leg"]
  124. RightArm=Character["Right Arm"]
  125. RightLeg=Character["Right Leg"]
  126. Neck=Torso["Neck"]
  127. LS=Torso["Left Shoulder"]
  128. LH=Torso["Left Hip"]
  129. RS=Torso["Right Shoulder"]
  130. RH=Torso["Right Hip"]
  131. necko=CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  132. LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0)
  133. LHC1=cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0)
  134. RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0)
  135. RHC1=cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0)
  136. RootPart=Character.HumanoidRootPart
  137. RootJoint=RootPart.RootJoint
  138. RootCF=euler(-1.57,0,3.14)
  139. RW, LW=Instance.new("Weld"), Instance.new("Weld")
  140. RHW, LHW=Instance.new("Weld"), Instance.new("Weld")
  141. RW.Name="Right Shoulder"
  142. LW.Name="Left Shoulder"
  143. RHW.Name="Right Hip"
  144. LHW.Name="Left Hip"
  145.  
  146. function swait(num)
  147. if num==0 or num==nil then
  148. game:service'RunService'.RenderStepped:wait()
  149. else
  150. for i=0,num do
  151. game:service'RunService'.RenderStepped:wait()
  152. end
  153. end
  154. end
  155.  
  156. local Animator
  157. if Hum1:FindFirstChild("Animator") ~= nil then
  158. Animator = Hum1:FindFirstChild("Animator"):clone()
  159. end
  160.  
  161. local Animate1
  162. if Character:FindFirstChild("Animate1") ~= nil then
  163. Animate1 = Character:FindFirstChild("Animate1"):clone()
  164. Animate1.Disabled = true
  165. end
  166.  
  167. local Mouse = Player:GetMouse()
  168. local Toggle = false
  169.  
  170. Mouse.KeyDown:connect(function(key)
  171. if key == "q" then
  172. if Toggle == false then
  173. Toggle = true
  174. else
  175. Toggle = false
  176. end
  177. end
  178. end)
  179.  
  180. RSH=Torso["Right Shoulder"]
  181. LSH=Torso["Left Shoulder"]
  182.  
  183.  
  184. local C = nil --cloner
  185. local SFX = nil
  186. local Anim,LAnim
  187. local Init = false
  188. while true do
  189.  
  190. swait()
  191.  
  192. if Toggle == true then
  193.  
  194. if Init == false then
  195.  
  196. if SFX == nil and Head:FindFirstChild("SFX") == nil then
  197. SFX = Instance.new("Sound",Head)
  198. SFX.Name = "SFX"
  199. SFX.Looped = true
  200. SFX.SoundId = "rbxassetid://170184872"
  201. SFX.Volume = 1
  202. swait()
  203. end
  204.  
  205. if SFX ~= nil then
  206. SFX:Play()
  207. end
  208.  
  209. RSH.Parent=nil
  210. LSH.Parent=nil
  211. RH.Parent=nil
  212. LH.Parent=nil
  213. --
  214. RW.Name="Right Shoulder"
  215. RW.Part0=Torso
  216. RW.C0=CFrame.new(1.5, 0.5, 0)
  217. RW.C1=CFrame.new(0, 0.5, 0)
  218. RW.Part1=Character["Right Arm"]
  219. RW.Parent=Torso
  220. --
  221. LW.Name="Left Shoulder"
  222. LW.Part0=Torso
  223. LW.C0=CFrame.new(-1.5, 0.5, 0)
  224. LW.C1=CFrame.new(0, 0.5, 0)
  225. LW.Part1=Character["Left Arm"]
  226. LW.Parent=Torso
  227. --
  228.  
  229. RHW.Name="Right Hip"
  230. RHW.Part0=Torso
  231. RHW.C0=CFrame.new(1, -1, 0)
  232. RHW.C1=CFrame.new(0.5, 1, 0)
  233. RHW.Part1=Character["Right Leg"]
  234. RHW.Parent=Torso
  235. --
  236. LHW.Name="Left Hip"
  237. LHW.Part0=Torso
  238. LHW.C0=CFrame.new(-1, -1, 0)
  239. LHW.C1=CFrame.new(-0.5, 1, 0)
  240. LHW.Part1=Character["Left Leg"]
  241. LHW.Parent=Torso
  242. Init = true
  243. end
  244.  
  245. -- animations
  246.  
  247.  
  248.  
  249. for i=0,.6,0.085 do
  250. if Toggle == false then
  251. break
  252. end
  253. swait()
  254. Neck.C0=clerp(Neck.C0,necko * euler(0,0,0),0.6)
  255. RootJoint.C0=clerp(RootJoint.C0,cf(0,0,0) * euler(-1.9,0,3.14),0.6)
  256. LHW.C0 = clerp(LHW.C0,cf(-1,-1,.25) * euler(0.5,0,-.25),0.6)
  257. RHW.C0 = clerp(RHW.C0,cf(1,-1,.25) * euler(0.5,0,.25),0.6)
  258. RW.C0 = clerp(RW.C0,cf(1.25, 0.25, -0.25) * euler(0.5,0,-.15),0.6)
  259. LW.C0 = clerp(LW.C0,cf(-1.25, 0.25, -0.25) * euler(0.5,0,.15),0.6)
  260. end
  261.  
  262. swait()
  263.  
  264. for i=0,.6,0.085 do
  265. if Toggle == false then
  266. break
  267. end
  268. swait()
  269. Neck.C0=clerp(Neck.C0,necko * euler(-0.25,0,0),0.6)
  270. RootJoint.C0=clerp(RootJoint.C0,cf(0,-0.1,0) * euler(-2,0,3.14),0.6)
  271. LHW.C0 = clerp(LHW.C0,cf(-1,-1,.25) * euler(0.65,0,-.3),0.6)
  272. RHW.C0 = clerp(RHW.C0,cf(1,-1,.25) * euler(0.65,0,.3),0.6)
  273. RW.C0 = clerp(RW.C0,cf(1.25, 0.25, -0.25) * euler(0.5,0,-.15),0.6)
  274. LW.C0 = clerp(LW.C0,cf(-1.25, 0.25, -0.25) * euler(0.5,0,.15),0.6)
  275. end
  276.  
  277. -- animations end
  278.  
  279. else
  280. if Init == true then
  281. for i=0,.5,0.1 do
  282. --anim reset
  283. Neck.C0=clerp(Neck.C0,necko,0.5)
  284. RootJoint.C0=clerp(RootJoint.C0,RootCF,0.5)
  285. RW.C0 = clerp(RW.C0,cf(1.5, 0.25, 0), 0.5)
  286. LW.C0 = clerp(RW.C0,cf(-1.5, 0.25, 0),0.5)
  287. RHW.C0 = clerp(RHW.C0,cf(1, -1, 0),0.5)
  288. LHW.C0 = clerp(RHW.C0,cf(-1, -1, 0),0.5)
  289.  
  290. if SFX ~= nil then
  291. SFX:Stop()
  292. SFX:Destroy()
  293. SFX = nil
  294. end
  295.  
  296. RW.Parent=nil
  297. LW.Parent=nil
  298. RHW.Parent=nil
  299. LHW.Parent=nil
  300.  
  301. RSH.Parent=Character.Torso
  302. LSH.Parent=Character.Torso
  303. RH.Parent=Character.Torso
  304. LH.Parent=Character.Torso
  305.  
  306.  
  307. if Character:FindFirstChild("Animate1") ~= nil then
  308. Character:FindFirstChild("Animate1").Disabled = false
  309. end
  310. Init = false
  311. if Toggle == true then
  312. break
  313. end
  314. end
  315. end
  316.  
  317. end
  318. end
  319.  
  320. Hum1.Died:connect(function() Toggle = false; script:Remove(); end)]]
  321.  
  322. local a = Instance.new("LocalScript")
  323. a.Source = twerksrc
  324. a.Disabled = true
  325. a.Parent = game.Players.LocalPlayer.PlayerGui
  326. a.Disabled = false
Add Comment
Please, Sign In to add comment