Advertisement
SCR1PT_ED1T0R

FE Caramelldansen

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