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