SHOW:
|
|
- or go back to the newest paste.
1 | - | ----------------------------------------------- |
1 | + | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use r/ and not rl/") end |
2 | - | --DANCE TO THE BEAT, WAVE YOUR HANDS TOGETHER-- |
2 | + | local Player,game,owner = owner,game |
3 | - | ------------------------------------------------ |
3 | + | local RealPlayer = Player |
4 | - | --I wanted to make something like Heavy Dance.-- |
4 | + | do |
5 | - | -- ~Sugarie -- |
5 | + | print("FE Compatibility code by Mokiros") |
6 | - | ------------------------------------------------ |
6 | + | local rp = RealPlayer |
7 | script.Parent = rp.Character | |
8 | - | wait(1/60) |
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 | ||
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 | Effects = { } | |
145 | local Player = game:service'Players'.localPlayer | |
146 | local chara = Player.Character | |
147 | local Humanoid = chara:FindFirstChildOfClass("Humanoid") | |
148 | local Mouse = Player:GetMouse() | |
149 | local LeftArm = chara["Left Arm"] | |
150 | local RightArm = chara["Right Arm"] | |
151 | local LeftLeg = chara["Left Leg"] | |
152 | local RightLeg = chara["Right Leg"] | |
153 | local Head = chara.Head | |
154 | local Torso = chara.Torso | |
155 | local Camera = game.Workspace.CurrentCamera | |
156 | local RootPart = chara.HumanoidRootPart | |
157 | local RootJoint = RootPart.RootJoint | |
158 | local attack = false | |
159 | local Anim = 'Idle' | |
160 | local attacktype = 1 | |
161 | local delays = false | |
162 | local play = true | |
163 | local targetted = nil | |
164 | local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude | |
165 | local velocity = RootPart.Velocity.y | |
166 | local sine = 0 | |
167 | local change = 1 | |
168 | local doe = 0 | |
169 | local Create = LoadLibrary("RbxUtility").Create | |
170 | Humanoid.WalkSpeed = 7 | |
171 | ||
172 | Humanoid.Animator.Parent = nil | |
173 | chara.Animate.Parent = nil | |
174 | ||
175 | local newMotor = function(part0, part1, c0, c1) | |
176 | local w = Create('Motor'){ | |
177 | Parent = part0, | |
178 | Part0 = part0, | |
179 | Part1 = part1, | |
180 | C0 = c0, | |
181 | C1 = c1, | |
182 | } | |
183 | return w | |
184 | end | |
185 | ||
186 | function clerp(a, b, t) | |
187 | return a:lerp(b, t) | |
188 | end | |
189 | ||
190 | RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14) | |
191 | NeckCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
192 | ||
193 | local RW = newMotor(Torso, RightArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0)) | |
194 | local LW = newMotor(Torso, LeftArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0)) | |
195 | local RH = newMotor(Torso, RightLeg, CFrame.new(.5, -2, 0), CFrame.new(0, 0, 0)) | |
196 | local LH = newMotor(Torso, LeftLeg, CFrame.new(-.5, -2, 0), CFrame.new(0, 0, 0)) | |
197 | RootJoint.C1 = CFrame.new(0, 0, 0) | |
198 | RootJoint.C0 = CFrame.new(0, 0, 0) | |
199 | Torso.Neck.C1 = CFrame.new(0, 0, 0) | |
200 | Torso.Neck.C0 = CFrame.new(0, 1.5, 0) | |
201 | ||
202 | local rarmc1 = RW.C1 | |
203 | local larmc1 = LW.C1 | |
204 | local rlegc1 = RH.C1 | |
205 | local llegc1 = LH.C1 | |
206 | ||
207 | local resetc1 = false | |
208 | ||
209 | function PlayAnimationFromTable(table, speed, bool) | |
210 | RootJoint.C0 = clerp(RootJoint.C0, table[1], speed) | |
211 | Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed) | |
212 | RW.C0 = clerp(RW.C0, table[3], speed) | |
213 | LW.C0 = clerp(LW.C0, table[4], speed) | |
214 | RH.C0 = clerp(RH.C0, table[5], speed) | |
215 | LH.C0 = clerp(LH.C0, table[6], speed) | |
216 | if bool == true then | |
217 | if resetc1 == false then | |
218 | resetc1 = true | |
219 | RootJoint.C1 = RootJoint.C1 | |
220 | Torso.Neck.C1 = Torso.Neck.C1 | |
221 | RW.C1 = rarmc1 | |
222 | LW.C1 = larmc1 | |
223 | RH.C1 = rlegc1 | |
224 | LH.C1 = llegc1 | |
225 | end | |
226 | end | |
227 | end | |
228 | ||
229 | ArtificialHB = Instance.new("BindableEvent", script) | |
230 | ArtificialHB.Name = "Heartbeat" | |
231 | script:WaitForChild("Heartbeat") | |
232 | frame = 0.03333333333333 | |
233 | tf = 0 | |
234 | allowframeloss = false | |
235 | tossremainder = false | |
236 | lastframe = tick() | |
237 | script.Heartbeat:Fire() | |
238 | game:GetService("RunService").Heartbeat:connect(function(s, p) | |
239 | tf = tf + s | |
240 | if tf >= frame then | |
241 | if allowframeloss then | |
242 | script.Heartbeat:Fire() | |
243 | lastframe = tick() | |
244 | else | |
245 | for i = 1, math.floor(tf / frame) do | |
246 | script.Heartbeat:Fire() | |
247 | end | |
248 | lastframe = tick() | |
249 | end | |
250 | if tossremainder then | |
251 | tf = 0 | |
252 | else | |
253 | tf = tf - frame * math.floor(tf / frame) | |
254 | end | |
255 | end | |
256 | end) | |
257 | function swait(num) | |
258 | if num == 0 or num == nil then | |
259 | ArtificialHB.Event:wait() | |
260 | else | |
261 | for i = 0, num do | |
262 | ArtificialHB.Event:wait() | |
263 | end | |
264 | end | |
265 | end | |
266 | ||
267 | function RemoveOutlines(part) | |
268 | part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10 | |
269 | end | |
270 | ||
271 | sndid = "rbxassetid://176322684" | |
272 | sndpi = .7 | |
273 | saun = Instance.new("Sound",Head) | |
274 | saun.Volume = 1 | |
275 | saun.Pitch = sndpi | |
276 | saun.SoundId = sndid | |
277 | saun.Name = "a" | |
278 | saun.Looped = true | |
279 | saun:Play() | |
280 | ||
281 | dant = 0 | |
282 | ||
283 | Mouse.KeyDown:connect(function(key) | |
284 | key=key:lower() | |
285 | if key=="f" then | |
286 | if dant == 0 then | |
287 | dant = 1 | |
288 | sndid = "rbxassetid://863979846" | |
289 | sndpi = 1 | |
290 | elseif dant == 1 then | |
291 | dant = 0 | |
292 | sndid = "rbxassetid://176322684" | |
293 | sndpi = .7 | |
294 | end | |
295 | saun.Pitch = sndpi | |
296 | saun.SoundId = sndid | |
297 | saun:Play() | |
298 | end | |
299 | end) | |
300 | ||
301 | while true do | |
302 | if Head:FindFirstChild("a")==nil then | |
303 | saun = Instance.new("Sound",Head) | |
304 | saun.Volume = 1 | |
305 | saun.Pitch = sndpi | |
306 | saun.SoundId = sndid | |
307 | saun.Name = "a" | |
308 | saun.Looped = true | |
309 | saun:Play() | |
310 | end | |
311 | if dant == 0 then | |
312 | for i = 0, 1, 0.25 do | |
313 | swait() | |
314 | PlayAnimationFromTable({ | |
315 | CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
316 | CFrame.new(0, 1.4999938, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
317 | 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), | |
318 | 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), | |
319 | CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
320 | CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
321 | }, .5, false) | |
322 | end | |
323 | for i = 0, 1, 0.25 do | |
324 | swait() | |
325 | PlayAnimationFromTable({ | |
326 | CFrame.new(-0.268402338, -0.187939167, 0, 0.939692736, 0.342019886, 0, -0.342019916, 0.939692736, 0, 0, 0, 1), | |
327 | CFrame.new(-0.409892142, 1.36144388, 0, 0.766044796, -0.642787218, 0, 0.642787218, 0.766044855, 0, 0, 0, 1), | |
328 | 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), | |
329 | 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), | |
330 | CFrame.new(0.951213062, -1.54518354, 0, 0.866025686, -0.499999642, 0, 0.499999642, 0.866025686, 0, 0, 0, 1), | |
331 | CFrame.new(0.214191973, -1.8503952, 0, 0.766044796, -0.642787218, 0, 0.642787218, 0.766044855, 0, 0, 0, 1), | |
332 | }, .5, false) | |
333 | end | |
334 | for i = 0, 1, 0.25 do | |
335 | swait() | |
336 | PlayAnimationFromTable({ | |
337 | CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
338 | CFrame.new(0, 1.4999938, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
339 | 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), | |
340 | 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), | |
341 | CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
342 | CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
343 | }, .5, false) | |
344 | end | |
345 | for i = 0, 1, 0.25 do | |
346 | swait() | |
347 | PlayAnimationFromTable({ | |
348 | CFrame.new(0.268400908, -0.187940732, 0, 0.939692855, -0.342019945, 0, 0.342019975, 0.939692795, 0, 0, 0, 1), | |
349 | CFrame.new(0.409947664, 1.36144304, 0, 0.766039729, 0.642798781, 0, -0.642787337, 0.766043961, 0, 0, 0, 1), | |
350 | 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), | |
351 | 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), | |
352 | CFrame.new(-0.214235365, -1.8503921, 0, 0.766041398, 0.64279145, 0, -0.64279151, 0.766041279, 0, 0, 0, 1), | |
353 | CFrame.new(-0.965987146, -1.57677674, 0, 0.866024733, 0.500001609, 0, -0.500001609, 0.866024613, 0, 0, 0, 1), | |
354 | }, .5, false) | |
355 | end | |
356 | elseif dant == 1 then | |
357 | for i = 0, 1, 0.1 do | |
358 | swait() | |
359 | PlayAnimationFromTable({ | |
360 | CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
361 | CFrame.new(0, 1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
362 | CFrame.new(1.09999847, 1.1920929e-07, -0.600001514, 0, 0, 1, 0.173647985, 0.984807849, 0, -0.984807849, 0.173647985, 0), | |
363 | CFrame.new(-1.09999847, 1.1920929e-07, -0.600001514, 0, 0, -1, -0.173647985, 0.984807849, 0, 0.984807849, 0.173647985, 0), | |
364 | CFrame.new(0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
365 | CFrame.new(-0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
366 | }, .2, false) | |
367 | end | |
368 | for i = 0, 1, 0.1 do | |
369 | swait() | |
370 | PlayAnimationFromTable({ | |
371 | CFrame.new(-0.0436433926, 0, -0.113613628, 0.64278698, 0, -0.766044974, 0, 1, 0, 0.766044974, 0, 0.64278698), | |
372 | CFrame.new(0, 1.49999809, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
373 | CFrame.new(1.09998989, 1, -0.599998474, 0, 0, 1, 1, 0, 0, 0, 1, 0), | |
374 | CFrame.new(-1.10000229, 1, -0.599998474, 0, 0, -1, -1, 0, 0, 0, 1, 0), | |
375 | CFrame.new(0.499988556, -1.99999797, -3.81469727e-06, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
376 | CFrame.new(-0.500012398, -1.78038144, -0.819608092, 1, 0, 1.49011612e-08, 0, 0.499999046, -0.866025984, 0, 0.866026044, 0.499999046), | |
377 | }, .2, false) | |
378 | end | |
379 | for i = 0, 1, 0.1 do | |
380 | swait() | |
381 | PlayAnimationFromTable({ | |
382 | CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
383 | CFrame.new(0, 1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
384 | CFrame.new(1.09999847, 1.1920929e-07, -0.600001514, 0, 0, 1, 0.173647985, 0.984807849, 0, -0.984807849, 0.173647985, 0), | |
385 | CFrame.new(-1.09999847, 1.1920929e-07, -0.600001514, 0, 0, -1, -0.173647985, 0.984807849, 0, 0.984807849, 0.173647985, 0), | |
386 | CFrame.new(0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
387 | CFrame.new(-0.5, -1.99999881, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), | |
388 | }, .2, false) | |
389 | end | |
390 | for i = 0, 1, 0.1 do | |
391 | swait() | |
392 | PlayAnimationFromTable({ | |
393 | CFrame.new(0.261404335, 0, -0.167939946, 0.76604414, 0, 0.642788053, 0, 1, 0, -0.642788053, 0, 0.76604414), | |
394 | CFrame.new(0, 1.49999285, 0, 1.00000012, 0, 0, 0, 1, 0, 0, 0, 1.00000012), | |
395 | CFrame.new(1.10000622, 0.999999046, -0.599996626, 0, 0, 1.00000012, 1, 0, 0, 0, 1.00000012, 0), | |
396 | CFrame.new(-1.09999859, 0.999999046, -0.59999758, 0, 0, -1.00000012, -1, 0, 0, 0, 1.00000012, 0), | |
397 | 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), | |
398 | CFrame.new(-0.500003874, -1.99999893, 3.81469772e-06, 1.00000012, 0, 0, 0, 1, 0, 0, 0, 1.00000012), | |
399 | }, .2, false) | |
400 | end | |
401 | end | |
402 | end |