-----------------

dancing thingy (prob fe if not broken)

Oct 24th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.18 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152. -----------------------------------------------
  153. --DANCE TO THE BEAT, WAVE YOUR HANDS TOGETHER--
  154. ------------------------------------------------
  155. --I wanted to make something like Heavy Dance.--
  156. -- ~Sugarie --
  157. ------------------------------------------------
  158.  
  159. wait(1/60)
  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://176322684"
  288. sndpi = .7
  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://448668887"
  305. sndpi = 1
  306. elseif dant == 1 then
  307. dant = 0
  308. sndid = "rbxassetid://176322684"
  309. sndpi = .7
  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
Add Comment
Please, Sign In to add comment