Advertisement
WagnerJunio07

Caramelldansen

Dec 14th, 2018
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.65 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. -----------------------------------------------
  88. --DANCE TO THE BEAT, WAVE YOUR HANDS TOGETHER--
  89. ------------------------------------------------
  90. --I wanted to make something like Heavy Dance.--
  91. -- ~Sugarie --
  92. ------------------------------------------------
  93.  
  94. wait(1/60)
  95. Effects = { }
  96. local Player = owner
  97. local chara = Player.Character
  98. local Humanoid = chara:FindFirstChildOfClass("Humanoid")
  99. local LeftArm = chara["Left Arm"]
  100. local RightArm = chara["Right Arm"]
  101. local LeftLeg = chara["Left Leg"]
  102. local RightLeg = chara["Right Leg"]
  103. local Head = chara.Head
  104. local Torso = chara.Torso
  105. local Camera = game.Workspace.CurrentCamera
  106. local RootPart = chara.HumanoidRootPart
  107. local RootJoint = RootPart.RootJoint
  108. local attack = false
  109. local Anim = 'Idle'
  110. local attacktype = 1
  111. local delays = false
  112. local play = true
  113. local targetted = nil
  114. local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
  115. local velocity = RootPart.Velocity.y
  116. local sine = 0
  117. local change = 1
  118. local doe = 0
  119. local Create = LoadLibrary("RbxUtility").Create
  120. Humanoid.WalkSpeed = 2
  121.  
  122. Humanoid.Animator.Parent = nil
  123. chara.Animate.Parent = nil
  124.  
  125. local newMotor = function(part0, part1, c0, c1)
  126. local w = Create('Motor'){
  127. Parent = part0,
  128. Part0 = part0,
  129. Part1 = part1,
  130. C0 = c0,
  131. C1 = c1,
  132. }
  133. return w
  134. end
  135.  
  136. function clerp(a, b, t)
  137. return a:lerp(b, t)
  138. end
  139.  
  140. RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  141. NeckCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  142.  
  143. local RW = newMotor(Torso, RightArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0))
  144. local LW = newMotor(Torso, LeftArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0))
  145. local RH = newMotor(Torso, RightLeg, CFrame.new(.5, -2, 0), CFrame.new(0, 0, 0))
  146. local LH = newMotor(Torso, LeftLeg, CFrame.new(-.5, -2, 0), CFrame.new(0, 0, 0))
  147. RootJoint.C1 = CFrame.new(0, 0, 0)
  148. RootJoint.C0 = CFrame.new(0, 0, 0)
  149. Torso.Neck.C1 = CFrame.new(0, 0, 0)
  150. Torso.Neck.C0 = CFrame.new(0, 1.5, 0)
  151.  
  152. local rarmc1 = RW.C1
  153. local larmc1 = LW.C1
  154. local rlegc1 = RH.C1
  155. local llegc1 = LH.C1
  156.  
  157. local resetc1 = false
  158.  
  159. function PlayAnimationFromTable(table, speed, bool)
  160. RootJoint.C0 = clerp(RootJoint.C0, table[1], speed)
  161. Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed)
  162. RW.C0 = clerp(RW.C0, table[3], speed)
  163. LW.C0 = clerp(LW.C0, table[4], speed)
  164. RH.C0 = clerp(RH.C0, table[5], speed)
  165. LH.C0 = clerp(LH.C0, table[6], speed)
  166. if bool == true then
  167. if resetc1 == false then
  168. resetc1 = true
  169. RootJoint.C1 = RootJoint.C1
  170. Torso.Neck.C1 = Torso.Neck.C1
  171. RW.C1 = rarmc1
  172. LW.C1 = larmc1
  173. RH.C1 = rlegc1
  174. LH.C1 = llegc1
  175. end
  176. end
  177. end
  178.  
  179. ArtificialHB = Instance.new("BindableEvent", script)
  180. ArtificialHB.Name = "Heartbeat"
  181. script:WaitForChild("Heartbeat")
  182. frame = 0.03333333333333
  183. tf = 0
  184. allowframeloss = false
  185. tossremainder = false
  186. lastframe = tick()
  187. script.Heartbeat:Fire()
  188. game:GetService("RunService").Heartbeat:connect(function(s, p)
  189. tf = tf + s
  190. if tf >= frame then
  191. if allowframeloss then
  192. script.Heartbeat:Fire()
  193. lastframe = tick()
  194. else
  195. for i = 1, math.floor(tf / frame) do
  196. script.Heartbeat:Fire()
  197. end
  198. lastframe = tick()
  199. end
  200. if tossremainder then
  201. tf = 0
  202. else
  203. tf = tf - frame * math.floor(tf / frame)
  204. end
  205. end
  206. end)
  207. function swait(num)
  208. if num == 0 or num == nil then
  209. ArtificialHB.Event:wait()
  210. else
  211. for i = 0, num do
  212. ArtificialHB.Event:wait()
  213. end
  214. end
  215. end
  216.  
  217. function RemoveOutlines(part)
  218. part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
  219. end
  220.  
  221. sndid = "rbxassetid://176322684"
  222. sndpi = .7
  223. saun = Instance.new("Sound",Head)
  224. saun.Volume = 1
  225. saun.Pitch = sndpi
  226. saun.SoundId = sndid
  227. saun.Name = "a"
  228. saun.Looped = true
  229. saun:Play()
  230.  
  231. dant = 0
  232.  
  233. Mouse.KeyDown:connect(function(key)
  234. key=key:lower()
  235. if key=="e" then
  236. if dant == 0 then
  237. dant = 1
  238. sndid = "rbxassetid://448668887"
  239. sndpi = 1
  240. elseif dant == 1 then
  241. dant = 0
  242. sndid = "rbxassetid://176322684"
  243. sndpi = .7
  244. end
  245. saun.Pitch = sndpi
  246. saun.SoundId = sndid
  247. saun:Play()
  248. end
  249. end)
  250.  
  251. while true do
  252. if Head:FindFirstChild("a")==nil then
  253. saun = Instance.new("Sound",Head)
  254. saun.Volume = 1
  255. saun.Pitch = sndpi
  256. saun.SoundId = sndid
  257. saun.Name = "a"
  258. saun.Looped = true
  259. saun:Play()
  260. end
  261. if dant == 0 then
  262. for i = 0, 1, 0.25 do
  263. swait()
  264. PlayAnimationFromTable({
  265. CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  266. CFrame.new(0, 1.4999938, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  267. 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),
  268. 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),
  269. CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  270. CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  271. }, .5, false)
  272. end
  273. for i = 0, 1, 0.25 do
  274. swait()
  275. PlayAnimationFromTable({
  276. CFrame.new(-0.268402338, -0.187939167, 0, 0.939692736, 0.342019886, 0, -0.342019916, 0.939692736, 0, 0, 0, 1),
  277. CFrame.new(-0.409892142, 1.36144388, 0, 0.766044796, -0.642787218, 0, 0.642787218, 0.766044855, 0, 0, 0, 1),
  278. 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),
  279. 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),
  280. CFrame.new(0.951213062, -1.54518354, 0, 0.866025686, -0.499999642, 0, 0.499999642, 0.866025686, 0, 0, 0, 1),
  281. CFrame.new(0.214191973, -1.8503952, 0, 0.766044796, -0.642787218, 0, 0.642787218, 0.766044855, 0, 0, 0, 1),
  282. }, .5, false)
  283. end
  284. for i = 0, 1, 0.25 do
  285. swait()
  286. PlayAnimationFromTable({
  287. CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  288. CFrame.new(0, 1.4999938, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  289. 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),
  290. 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),
  291. CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  292. CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  293. }, .5, false)
  294. end
  295. for i = 0, 1, 0.25 do
  296. swait()
  297. PlayAnimationFromTable({
  298. CFrame.new(0.268400908, -0.187940732, 0, 0.939692855, -0.342019945, 0, 0.342019975, 0.939692795, 0, 0, 0, 1),
  299. CFrame.new(0.409947664, 1.36144304, 0, 0.766039729, 0.642798781, 0, -0.642787337, 0.766043961, 0, 0, 0, 1),
  300. 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),
  301. 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),
  302. CFrame.new(-0.214235365, -1.8503921, 0, 0.766041398, 0.64279145, 0, -0.64279151, 0.766041279, 0, 0, 0, 1),
  303. CFrame.new(-0.965987146, -1.57677674, 0, 0.866024733, 0.500001609, 0, -0.500001609, 0.866024613, 0, 0, 0, 1),
  304. }, .5, false)
  305. end
  306. elseif dant == 1 then
  307. for i = 0, 1, 0.1 do
  308. swait()
  309. PlayAnimationFromTable({
  310. CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  311. CFrame.new(0, 1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  312. CFrame.new(1.09999847, 1.1920929e-07, -0.600001514, 0, 0, 1, 0.173647985, 0.984807849, 0, -0.984807849, 0.173647985, 0),
  313. CFrame.new(-1.09999847, 1.1920929e-07, -0.600001514, 0, 0, -1, -0.173647985, 0.984807849, 0, 0.984807849, 0.173647985, 0),
  314. CFrame.new(0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  315. CFrame.new(-0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  316. }, .2, false)
  317. end
  318. for i = 0, 1, 0.1 do
  319. swait()
  320. PlayAnimationFromTable({
  321. CFrame.new(-0.0436433926, 0, -0.113613628, 0.64278698, 0, -0.766044974, 0, 1, 0, 0.766044974, 0, 0.64278698),
  322. CFrame.new(0, 1.49999809, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  323. CFrame.new(1.09998989, 1, -0.599998474, 0, 0, 1, 1, 0, 0, 0, 1, 0),
  324. CFrame.new(-1.10000229, 1, -0.599998474, 0, 0, -1, -1, 0, 0, 0, 1, 0),
  325. CFrame.new(0.499988556, -1.99999797, -3.81469727e-06, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  326. CFrame.new(-0.500012398, -1.78038144, -0.819608092, 1, 0, 1.49011612e-08, 0, 0.499999046, -0.866025984, 0, 0.866026044, 0.499999046),
  327. }, .2, false)
  328. end
  329. for i = 0, 1, 0.1 do
  330. swait()
  331. PlayAnimationFromTable({
  332. CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  333. CFrame.new(0, 1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  334. CFrame.new(1.09999847, 1.1920929e-07, -0.600001514, 0, 0, 1, 0.173647985, 0.984807849, 0, -0.984807849, 0.173647985, 0),
  335. CFrame.new(-1.09999847, 1.1920929e-07, -0.600001514, 0, 0, -1, -0.173647985, 0.984807849, 0, 0.984807849, 0.173647985, 0),
  336. CFrame.new(0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  337. CFrame.new(-0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
  338. }, .2, false)
  339. end
  340. for i = 0, 1, 0.1 do
  341. swait()
  342. PlayAnimationFromTable({
  343. CFrame.new(0.261404335, 0, -0.167939946, 0.76604414, 0, 0.642788053, 0, 1, 0, -0.642788053, 0, 0.76604414),
  344. CFrame.new(0, 1.49999285, 0, 1.00000012, 0, 0, 0, 1, 0, 0, 0, 1.00000012),
  345. CFrame.new(1.10000622, 0.999999046, -0.599996626, 0, 0, 1.00000012, 1, 0, 0, 0, 1.00000012, 0),
  346. CFrame.new(-1.09999859, 0.999999046, -0.59999758, 0, 0, -1.00000012, -1, 0, 0, 0, 1.00000012, 0),
  347. 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),
  348. CFrame.new(-0.500003874, -1.99999893, 3.81469772e-06, 1.00000012, 0, 0, 0, 1, 0, 0, 0, 1.00000012),
  349. }, .2, false)
  350. end
  351. end
  352. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement