Advertisement
SansTheHackerYT

Dance.

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