Advertisement
Guest User

carameldance

a guest
Jul 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.68 KB | None | 0 0
  1. DANCE TO THE BEAT, WAVE YOUR HANDS TOGETHER--
  2. ------------------------------------------------
  3. --I wanted to make something like Heavy Dance.--
  4. -- ~Sugarie                                   --
  5. ------------------------------------------------
  6.  
  7. wait(1/60)
  8. Effects = { }
  9. local Player = game:service'Players'.localPlayer
  10. local chara = Player.Character
  11. local Humanoid = chara:FindFirstChildOfClass("Humanoid")
  12. local Mouse = Player:GetMouse()
  13. local LeftArm = chara["Left Arm"]
  14. local RightArm = chara["Right Arm"]
  15. local LeftLeg = chara["Left Leg"]
  16. local RightLeg = chara["Right Leg"]
  17. local Head = chara.Head
  18. local Torso = chara.Torso
  19. local Camera = game.Workspace.CurrentCamera
  20. local RootPart = chara.HumanoidRootPart
  21. local RootJoint = RootPart.RootJoint
  22. local attack = false
  23. local Anim = 'Idle'
  24. local attacktype = 1
  25. local delays = false
  26. local play = true
  27. local targetted = nil
  28. local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
  29. local velocity = RootPart.Velocity.y
  30. local sine = 0
  31. local change = 1
  32. local doe = 0
  33. local Create = LoadLibrary("RbxUtility").Create
  34. Humanoid.WalkSpeed = 2
  35.  
  36. Humanoid.Animator.Parent = nil
  37. chara.Animate.Parent = nil
  38.  
  39. local newMotor = function(part0, part1, c0, c1)
  40.     local w = Create('Motor'){
  41.         Parent = part0,
  42.         Part0 = part0,
  43.         Part1 = part1,
  44.         C0 = c0,
  45.         C1 = c1,
  46.     }
  47.     return w
  48. end
  49.  
  50. function clerp(a, b, t)
  51.     return a:lerp(b, t)
  52. end
  53.  
  54. RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  55. NeckCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  56.  
  57. local RW = newMotor(Torso, RightArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0))
  58. local LW = newMotor(Torso, LeftArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0))
  59. local RH = newMotor(Torso, RightLeg, CFrame.new(.5, -2, 0), CFrame.new(0, 0, 0))
  60. local LH = newMotor(Torso, LeftLeg, CFrame.new(-.5, -2, 0), CFrame.new(0, 0, 0))
  61. RootJoint.C1 = CFrame.new(0, 0, 0)
  62. RootJoint.C0 = CFrame.new(0, 0, 0)
  63. Torso.Neck.C1 = CFrame.new(0, 0, 0)
  64. Torso.Neck.C0 = CFrame.new(0, 1.5, 0)
  65.  
  66. local rarmc1 = RW.C1
  67. local larmc1 = LW.C1
  68. local rlegc1 = RH.C1
  69. local llegc1 = LH.C1
  70.  
  71. local resetc1 = false
  72.  
  73. function PlayAnimationFromTable(table, speed, bool)
  74.     RootJoint.C0 = clerp(RootJoint.C0, table[1], speed)
  75.     Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed)
  76.     RW.C0 = clerp(RW.C0, table[3], speed)
  77.     LW.C0 = clerp(LW.C0, table[4], speed)
  78.     RH.C0 = clerp(RH.C0, table[5], speed)
  79.     LH.C0 = clerp(LH.C0, table[6], speed)
  80.     if bool == true then
  81.         if resetc1 == false then
  82.             resetc1 = true
  83.             RootJoint.C1 = RootJoint.C1
  84.             Torso.Neck.C1 = Torso.Neck.C1
  85.             RW.C1 = rarmc1
  86.             LW.C1 = larmc1
  87.             RH.C1 = rlegc1
  88.             LH.C1 = llegc1
  89.         end
  90.     end
  91. end
  92.  
  93. ArtificialHB = Instance.new("BindableEvent", script)
  94. ArtificialHB.Name = "Heartbeat"
  95. script:WaitForChild("Heartbeat")
  96. frame = 0.03333333333333
  97. tf = 0
  98. allowframeloss = false
  99. tossremainder = false
  100. lastframe = tick()
  101. script.Heartbeat:Fire()
  102. game:GetService("RunService").Heartbeat:connect(function(s, p)
  103.   tf = tf + s
  104.   if tf >= frame then
  105.     if allowframeloss then
  106.       script.Heartbeat:Fire()
  107.       lastframe = tick()
  108.     else
  109.       for i = 1, math.floor(tf / frame) do
  110.         script.Heartbeat:Fire()
  111.       end
  112.       lastframe = tick()
  113.     end
  114.     if tossremainder then
  115.       tf = 0
  116.     else
  117.       tf = tf - frame * math.floor(tf / frame)
  118.     end
  119.   end
  120. end)
  121. function swait(num)
  122.   if num == 0 or num == nil then
  123.     ArtificialHB.Event:wait()
  124.   else
  125.     for i = 0, num do
  126.       ArtificialHB.Event:wait()
  127.     end
  128.   end
  129. end
  130.  
  131. function RemoveOutlines(part)
  132.     part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
  133. end
  134.  
  135. sndid = "rbxassetid://176322684"
  136. sndpi = .7
  137. saun = Instance.new("Sound",Head)
  138. saun.Volume = 1
  139. saun.Pitch = sndpi
  140. saun.SoundId = sndid
  141. saun.Name = "a"
  142. saun.Looped = true
  143. saun:Play()
  144.  
  145. dant = 0
  146.  
  147. Mouse.KeyDown:connect(function(key)
  148. key=key:lower()
  149. if key=="e" then
  150. if dant == 0 then
  151. dant = 1
  152. sndid = "rbxassetid://448668887"
  153. sndpi = 1
  154. elseif dant == 1 then
  155. dant = 0
  156. sndid = "rbxassetid://176322684"
  157. sndpi = .7
  158. end
  159. saun.Pitch = sndpi
  160. saun.SoundId = sndid
  161. saun:Play()
  162. end
  163. end)
  164.  
  165. while true do
  166. if Head:FindFirstChild("a")==nil then
  167. saun = Instance.new("Sound",Head)
  168. saun.Volume = 1
  169. saun.Pitch = sndpi
  170. saun.SoundId = sndid
  171. saun.Name = "a"
  172. saun.Looped = true
  173. saun:Play()
  174. end
  175. if dant == 0 then
  176. for i = 0, 1, 0.25 do
  177. swait()
  178. PlayAnimationFromTable({
  179. CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  180. CFrame.new(0, 1.4999938, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  181. CFrame.new(0.833580494, 1.12330246, 6.2584877e-07, -0.342020094, -1.63087847e-07, 0.939692676, 0.321394086, -0.939692557, 0.116977669, 0.883022249, 0.342020333, 0.321393758),
  182. CFrame.new(-0.833579302, 1.12330115, -1.49011612e-07, -0.342019886, 4.07719511e-08, -0.939692736, -0.321392894, -0.939693034, 0.116977319, -0.883022726, 0.342019141, 0.321393728),
  183. CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  184. CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  185. }, .5, false)
  186. end
  187. for i = 0, 1, 0.25 do
  188. swait()
  189. PlayAnimationFromTable({
  190. CFrame.new(-0.268402338, -0.187939167, 0, 0.939692736, 0.342019886, 0, -0.342019916, 0.939692736, 0, 0, 0, 1),
  191. CFrame.new(-0.409892142, 1.36144388, 0, 0.766044796, -0.642787218, 0, 0.642787218, 0.766044855, 0, 0, 0, 1),
  192. CFrame.new(0.535924554, 1.16478181, 3.87430191e-07, -0.431316972, 0.32139343, 0.843013644, 0.185034022, -0.883022308, 0.431316644, 0.883022249, 0.342020333, 0.321393758),
  193. CFrame.new(-1.03069234, 0.594579875, -2.38418579e-07, -0.211470842, 0.321393758, -0.923030972, -0.418988168, -0.883022726, -0.211470872, -0.883022726, 0.342019141, 0.321393728),
  194. CFrame.new(0.951213062, -1.54518354, 0, 0.866025686, -0.499999642, 0, 0.499999642, 0.866025686, 0, 0, 0, 1),
  195. CFrame.new(0.214191973, -1.8503952, 0, 0.766044796, -0.642787218, 0, 0.642787218, 0.766044855, 0, 0, 0, 1),
  196. }, .5, false)
  197. end
  198. for i = 0, 1, 0.25 do
  199. swait()
  200. PlayAnimationFromTable({
  201. CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  202. CFrame.new(0, 1.4999938, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  203. CFrame.new(0.833580494, 1.12330246, 6.2584877e-07, -0.342020094, -1.63087847e-07, 0.939692676, 0.321394086, -0.939692557, 0.116977669, 0.883022249, 0.342020333, 0.321393758),
  204. CFrame.new(-0.833579302, 1.12330115, -1.49011612e-07, -0.342019886, 4.07719511e-08, -0.939692736, -0.321392894, -0.939693034, 0.116977319, -0.883022726, 0.342019141, 0.321393728),
  205. CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  206. CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  207. }, .5, false)
  208. end
  209. for i = 0, 1, 0.25 do
  210. swait()
  211. PlayAnimationFromTable({
  212. CFrame.new(0.268400908, -0.187940732, 0, 0.939692855, -0.342019945, 0, 0.342019975, 0.939692795, 0, 0, 0, 1),
  213. CFrame.new(0.409947664, 1.36144304, 0, 0.766039729, 0.642798781, 0, -0.642787337, 0.766043961, 0, 0, 0, 1),
  214. CFrame.new(1.03070939, 0.594575524, -2.2649765e-06, -0.21146287, -0.321413547, 0.923025966, 0.418989599, -0.883016884, -0.21149224, 0.883023918, 0.342015505, 0.321394145),
  215. CFrame.new(-0.535904408, 1.16477537, -3.27825546e-07, -0.431322306, -0.321409196, -0.843005002, -0.185032129, -0.883013964, 0.431334615, -0.883019984, 0.342027217, 0.321392536),
  216. CFrame.new(-0.214235365, -1.8503921, 0, 0.766041398, 0.64279145, 0, -0.64279151, 0.766041279, 0, 0, 0, 1),
  217. CFrame.new(-0.965987146, -1.57677674, 0, 0.866024733, 0.500001609, 0, -0.500001609, 0.866024613, 0, 0, 0, 1),
  218. }, .5, false)
  219. end
  220. elseif dant == 1 then
  221. for i = 0, 1, 0.1 do
  222. swait()
  223. PlayAnimationFromTable({
  224. CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  225. CFrame.new(0, 1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  226. CFrame.new(1.09999847, 1.1920929e-07, -0.600001514, 0, 0, 1, 0.173647985, 0.984807849, 0, -0.984807849, 0.173647985, 0),
  227. CFrame.new(-1.09999847, 1.1920929e-07, -0.600001514, 0, 0, -1, -0.173647985, 0.984807849, 0, 0.984807849, 0.173647985, 0),
  228. CFrame.new(0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  229. CFrame.new(-0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  230. }, .2, false)
  231. end
  232. for i = 0, 1, 0.1 do
  233. swait()
  234. PlayAnimationFromTable({
  235. CFrame.new(-0.0436433926, 0, -0.113613628, 0.64278698, 0, -0.766044974, 0, 1, 0, 0.766044974, 0, 0.64278698),
  236. CFrame.new(0, 1.49999809, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  237. CFrame.new(1.09998989, 1, -0.599998474, 0, 0, 1, 1, 0, 0, 0, 1, 0),
  238. CFrame.new(-1.10000229, 1, -0.599998474, 0, 0, -1, -1, 0, 0, 0, 1, 0),
  239. CFrame.new(0.499988556, -1.99999797, -3.81469727e-06, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  240. CFrame.new(-0.500012398, -1.78038144, -0.819608092, 1, 0, 1.49011612e-08, 0, 0.499999046, -0.866025984, 0, 0.866026044, 0.499999046),
  241. }, .2, false)
  242. end
  243. for i = 0, 1, 0.1 do
  244. swait()
  245. PlayAnimationFromTable({
  246. CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  247. CFrame.new(0, 1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  248. CFrame.new(1.09999847, 1.1920929e-07, -0.600001514, 0, 0, 1, 0.173647985, 0.984807849, 0, -0.984807849, 0.173647985, 0),
  249. CFrame.new(-1.09999847, 1.1920929e-07, -0.600001514, 0, 0, -1, -0.173647985, 0.984807849, 0, 0.984807849, 0.173647985, 0),
  250. CFrame.new(0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  251. CFrame.new(-0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  252. }, .2, false)
  253. end
  254. for i = 0, 1, 0.1 do
  255. swait()
  256. PlayAnimationFromTable({
  257. CFrame.new(0.261404335, 0, -0.167939946, 0.76604414, 0, 0.642788053, 0, 1, 0, -0.642788053, 0, 0.76604414),
  258. CFrame.new(0, 1.49999285, 0, 1.00000012, 0, 0, 0, 1, 0, 0, 0, 1.00000012),
  259. CFrame.new(1.10000622, 0.999999046, -0.599996626, 0, 0, 1.00000012, 1, 0, 0, 0, 1.00000012, 0),
  260. CFrame.new(-1.09999859, 0.999999046, -0.59999758, 0, 0, -1.00000012, -1, 0, 0, 0, 1.00000012, 0),
  261. CFrame.new(0.500000179, -1.78038287, -0.81961149, 1.00000012, -2.98023224e-08, 2.98023224e-08, 0, 0.499999046, -0.866025925, 0, 0.866025984, 0.499999106),
  262. CFrame.new(-0.500003874, -1.99999893, 3.81469772e-06, 1.00000012, 0, 0, 0, 1, 0, 0, 0, 1.00000012),
  263. }, .2, false)
  264. end
  265. end
  266. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement