Advertisement
AsukaOS

Fe Caramelldansen

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