Advertisement
Axprotss

Dancing script

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