View difference between Paste ID: XDqzTSNd and LEkXxRz9
SHOW: | | - or go back to the newest paste.
1
-- Press X where you wanna sit
2
3
4
local plr = game:service'Players'.LocalPlayer
5
6
local m = plr:GetMouse()
7
8
local char = plr.Character
9
10
local hed = plr.Character.Head
11
12
local runservice = game:service'RunService'
13
14
local modelScale = 1/5
15
16
plr.Chatted:connect(function(msg)
17
    game:service'Chat':Chat(hed, msg, 1)
18
    if msg == "die/" then
19
        char:breakJoints()
20
    end
21
   
22
end)
23
24
25
pcall(function() local a = script.Parent.FaerieScript if a ~= script then a:Destroy() end end)
26
27
pcall(function() local a = char.Animate if a ~= script then a.Disabled = true a:Destroy() end end)
28
29
script.Name = "FaerieScript"
30
31
32
function weld(a,b,c,d)
33
34
        local w = Instance.new("Weld",a)
35
36
        w.Part0 = a
37
38
        w.Part1 = b
39
40
        w.C0 = c or CFrame.new()
41
42
        w.C1 = d or CFrame.new()
43
44
        return w
45
46
end
47
48
49
function lerp(a,b,c)
50
51
    return a+(b-a)*c
52
53
end
54
55
56
do  -- Ignore my clerp stuff stolen from stravvy
57
58
        local function QuaternionFromCFrame(cf) 
59
60
                local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() 
61
62
                local trace = m00 + m11 + m22 
63
64
                if trace > 0 then 
65
66
                        local s = math.sqrt(1 + trace) 
67
68
                        local recip = 0.5/s 
69
70
                        return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 
71
72
                else 
73
74
                        local i = 0 
75
76
                        if m11 > m00 then
77
78
                                i = 1 
79
80
                        end 
81
82
                        if m22 > (i == 0 and m00 or m11) then 
83
84
                                i = 2 
85
86
                        end 
87
88
                        if i == 0 then 
89
90
                                local s = math.sqrt(m00-m11-m22+1) 
91
92
                                local recip = 0.5/s 
93
94
                                return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip 
95
96
                        elseif i == 1 then 
97
98
                                local s = math.sqrt(m11-m22-m00+1) 
99
100
                                local recip = 0.5/s 
101
102
                                return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip 
103
104
                        elseif i == 2 then 
105
106
                                local s = math.sqrt(m22-m00-m11+1) 
107
108
                                local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip 
109
110
                        end 
111
112
                end 
113
114
        end   
115
116
        local function QuaternionToCFrame(px, py, pz, x, y, z, w) 
117
118
                local xs, ys, zs = x + x, y + y, z + z 
119
120
                local wx, wy, wz = w*xs, w*ys, w*zs 
121
122
                local xx = x*xs 
123
124
                local xy = x*ys 
125
126
                local xz = x*zs 
127
128
                local yy = y*ys 
129
130
                local yz = y*zs 
131
132
                local zz = z*zs 
133
134
                return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) 
135
136
                end   
137
138
        local function QuaternionSlerp(a, b, t) 
139
140
                local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] 
141
142
                local startInterp, finishInterp; 
143
144
                if cosTheta >= 0.0001 then 
145
146
                        if (1 - cosTheta) > 0.0001 then 
147
148
                                local theta = math.acos(cosTheta) 
149
150
                                local invSinTheta = 1/math.sin(theta) 
151
152
                                startInterp = math.sin((1-t)*theta)*invSinTheta 
153
154
                                finishInterp = math.sin(t*theta)*invSinTheta  
155
156
                        else 
157
158
                                startInterp = 1-t 
159
160
                                finishInterp = t 
161
162
                        end 
163
164
                else 
165
166
                        if (1+cosTheta) > 0.0001 then 
167
168
                                local theta = math.acos(-cosTheta) 
169
170
                                local invSinTheta = 1/math.sin(theta) 
171
172
                                startInterp = math.sin((t-1)*theta)*invSinTheta 
173
174
                                finishInterp = math.sin(t*theta)*invSinTheta 
175
176
                        else 
177
178
                                startInterp = t-1 
179
180
                                finishInterp = t 
181
182
                        end 
183
184
                end 
185
186
                return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp 
187
188
        end  
189
190
        function clerp(a,b,t) 
191
192
                local qa = {QuaternionFromCFrame(a)}
193
194
                local qb = {QuaternionFromCFrame(b)} 
195
196
                local ax, ay, az = a.x, a.y, a.z 
197
198
                local bx, by, bz = b.x, b.y, b.z  
199
200
                local _t = 1-t 
201
202
                return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t)) 
203
204
        end 
205
206
end
207
208
209
for i,v in pairs(char:GetChildren()) do
210
211
        if v:IsA("Hat") or v:IsA("BodyColors") or v:IsA("Clothing") or v:IsA("ShirtGraphic") then
212
213
                v:Destroy()
214
215
        end
216
217
end
218
219
Instance.new("Hat",char)
220
221
local root = char.HumanoidRootPart
222
223
local tw = root.RootJoint
224
225
local tor = char.Torso
226
227
local hd = char.Head
228
229
local hum = char.Humanoid
230
231
hum.Health = 40
232
233
hum.MaxHealth = 40
234
235
hum.WalkSpeed = 12
236
237
local rl,ll = char["Right Leg"],char["Left Leg"]
238
239
local ra,la = char["Right Arm"],char["Left Arm"]
240
241
242
local c0 = {
243
244
        rs = CFrame.new(1,.5,0),
245
246
        ls = CFrame.new(-1,.5,0),
247
248
        rh = CFrame.new(.5,-1,0),
249
250
        lh = CFrame.new(-.5,-1,0),
251
252
        nk = CFrame.new(0,1,0),
253
254
        tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0),
255
256
}
257
258
local c1 = {
259
260
        rs = CFrame.new(-.5,.5,0),
261
262
        ls = CFrame.new(.5,.5,0),
263
264
        rh = CFrame.new(0,1,0),
265
266
        lh = CFrame.new(0,1,0),
267
268
        nk = CFrame.new(0,-.5,0),
269
270
        tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0)
271
272
}
273
274
275
local rs = tor["Right Shoulder"]
276
277
local ls = tor["Left Shoulder"]
278
279
local rh = tor["Right Hip"]
280
281
local lh = tor["Left Hip"]
282
283
local nk = tor["Neck"]
284
285
for i,v in pairs(tor:GetChildren()) do
286
287
        if v:IsA("Motor6D") then
288
289
                v.DesiredAngle = 0
290
291
                v.MaxVelocity = 0
292
293
                v.CurrentAngle = 0
294
295
        end
296
297
end
298
299
300
301
302
303
pcall(function() tor.roblox:Destroy() end)
304
305
306
pcall(function() char.Faerie:Destroy() end)
307
308
local model = Instance.new("Model",char)
309
310
model.Name = "Faerie"
311
312
313
local BasePart = Instance.new("Part")
314
315
BasePart.CanCollide = false
316
317
BasePart.Anchored = false
318
319
BasePart.FormFactor = "Custom"
320
321
BasePart.Locked = true
322
323
BasePart.Size = Vector3.new()
324
325
BasePart.TopSurface,BasePart.BottomSurface,BasePart.LeftSurface,BasePart.RightSurface,BasePart.FrontSurface,BasePart.BackSurface = 10,10,10,10,10,10
326
327
BasePart:BreakJoints()
328
329
330
function NP(par)
331
332
    local p = BasePart:Clone()
333
334
    p.Parent = par or model
335
336
    return p
337
338
end
339
340
341
local w1 = NP()
342
343
w1.Transparency = .1
344
345
local w1m = Instance.new("SpecialMesh",w1)
346
347
w1m.MeshId = "rbxassetid://19367766"
348
349
w1m.TextureId = "rbxassetid://9854798"
350
351
w1m.Scale = Vector3.new(1.05, 1.05, 1.05)
352
353
local w1 = weld(tor,w1,CFrame.new(-.1,0.55,1.6))
354
355
356
local w2 = NP()
357
358
w2.Transparency = .1
359
360
local w2m = Instance.new("SpecialMesh",w2)
361
362
w2m.MeshId = "rbxassetid://19367766"
363
364
w2m.TextureId = "rbxassetid://9854798"
365
366
w2m.Scale = Vector3.new(1.05, 1.05, 1.05)
367
368
local w2 = weld(tor,w2,CFrame.new(.1,0.55,1.6))
369
370
371
local h = NP()
372
373
local hm = Instance.new("SpecialMesh",h)
374
375
hm.MeshId = "rbxassetid://154820214"
376
377
hm.TextureId = "rbxassetid://91740209"
378
379
hm.Scale = Vector3.new(1, 1, 1)
380
381
weld(hd,h,CFrame.new(0,0.2,0))
382
383
384
for i,v in pairs(char:GetChildren()) do
385
386
        if v:IsA("BasePart") then
387
388
                v.Material = "SmoothPlastic"
389
390
                v.TopSurface,v.BottomSurface,v.FrontSurface,v.BackSurface,v.LeftSurface,v.RightSurface = 10,10,10,10,10,10
391
392
        end
393
394
end
395
396
397
do
398
399
        if modelScale ~= 1 then
400
401
                for i,v in pairs(c0) do
402
403
                        c0[i] = (v-v.p) + v.p*modelScale
404
405
                end
406
407
                for i,v in pairs(c1) do
408
409
                        c1[i] = (v-v.p) + v.p*modelScale
410
411
                end
412
413
                local Joints = {}
414
415
            local gtJoints,gtParts;
416
417
418
            local function gtCFrame(cf)
419
420
                return (cf-cf.p) + cf.p * modelScale
421
422
            end
423
424
425
            function gtJoints(p)
426
427
                for i,v in pairs(p:GetChildren()) do
428
429
                    if v:IsA("JointInstance") then
430
431
                        table.insert(Joints,{v,v.Part0,v.Part1})
432
433
                        v.Part0 = nil
434
435
                        v.Part1 = nil
436
437
                        v.C0 = (v.C0-(v.C0.p)) + (v.C0.p * modelScale) 
438
439
                        v.C1 = (v.C1-(v.C1.p)) + (v.C1.p * modelScale) 
440
441
                    end
442
443
                    gtJoints(v)
444
445
                end 
446
447
            end
448
449
450
            function gtParts(p)
451
452
                for i,v in pairs(p:GetChildren()) do
453
454
                    if v:IsA("BasePart") then
455
456
                        pcall(function() v.FormFactor = "Custom" end)
457
458
                        local oldz = v.Size
459
460
                        local cf = tor.CFrame:toObjectSpace(v.CFrame)
461
462
                        v.Size = v.Size * modelScale
463
464
                        v.CFrame = tor.CFrame * gtCFrame(cf)
465
466
                        local mesh = nil
467
468
                        for i,t in pairs(v:GetChildren()) do 
469
470
                            if t:IsA("DataModelMesh") then 
471
472
                                mesh = t 
473
474
                            end 
475
476
                        end
477
478
                        if mesh == nil and v:IsA("Part") and v.Shape == Enum.PartType.Ball then 
479
480
                            mesh = Instance.new("SpecialMesh",v) 
481
482
                            mesh.MeshType = Enum.MeshType.Sphere 
483
484
                        end
485
486
                        if mesh == nil and ((v:IsA("Part") and v.Shape == Enum.PartType.Block) or v:IsA("Seat") or v:IsA("VehicleSeat")) then 
487
488
                            mesh = Instance.new("BlockMesh",v) 
489
490
                        end
491
492
                        if mesh ~= nil then
493
494
                                if mesh:IsA("SpecialMesh") and mesh.MeshType == Enum.MeshType.FileMesh then
495
496
                                        mesh.Scale = mesh.Scale * modelScale
497
498
                                else
499
500
                                    mesh.Scale = mesh.Scale*(oldz*modelScale)/v.Size
501
502
                            end
503
504
                        end
505
506
                    end
507
508
                    gtParts(v)
509
510
                end 
511
512
            end
513
514
            gtJoints(char)
515
516
            gtParts(char)
517
518
            for i,v in pairs(Joints) do
519
520
                v[1].Part0 = v[2]
521
522
                v[1].Part1 = v[3]
523
524
            end
525
526
        end
527
528
end
529
530
rs.C0,rs.C1 = c0.rs,c1.rs
531
532
ls.C0,ls.C1 = c0.ls,c1.ls
533
534
rh.C0,rh.C1 = c0.rh,c1.rh
535
536
lh.C0,lh.C1 = c0.lh,c1.lh
537
538
nk.C0,nk.C1 = c0.nk,c1.nk
539
540
tw.C0,tw.C1 = c0.tw,c1.tw
541
542
543
local w10,w20 = w1.C0,w2.C0
544
545
546
local pl = tor:FindFirstChild("FairyLight") or Instance.new("PointLight",tor)
547
548
pl.Name = "FairyLight"
549
550
pl.Shadows = false
551
552
pl.Range = 8
553
554
pl.Brightness = 10
555
556
557
local sparkles = tor:FindFirstChild("FairySparkles") or Instance.new("Sparkles",tor)
558
559
sparkles.Name = "FairySparkles"
560
561
562
563
local outfit = 0
564
565
local outfitparts = {ra,la,rl,ll,tor}
566
567
local outfits = {
568
569
        {{106705109},{106705077},{106703301},{106703213},{106705037}}
570
571
}
572
573
574
575
local mycolor = ll.BrickColor.Color
576
577
local mycolor2 = mycolor
578
579
580
function setOutfit()
581
582
        local of = outfits[outfit]
583
584
        if of then
585
586
                for i,v in pairs(outfitparts) do
587
588
                        local mesh = v:FindFirstChild("outfitMesh")
589
590
                        local meshdata = outfits[outfit][i]
591
592
                        if not mesh then
593
594
                                mesh = Instance.new("SpecialMesh",v)
595
596
                                mesh.Name = "outfitMesh"
597
598
                                mesh.TextureId = "rbxassetid://9854798"
599
600
                        end
601
602
                        mesh.Scale =(meshdata[2] or Vector3.new(1,1,1)) * modelScale
603
604
                        mesh.MeshId = "rbxassetid://"..meshdata[1]
605
606
                        mesh.VertexColor = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b)
607
608
                end
609
610
        else
611
612
                for i,v in pairs(outfitparts) do
613
614
                        pcall(function() v.outfitMesh:Destroy() end)
615
616
                end
617
618
        end
619
620
end
621
622
setOutfit()
623
624
625
local senabled = true
626
627
local lenabled = true
628
629
function changeColor()
630
631
        for i,v in pairs(char:GetChildren()) do
632
633
                if v:IsA("BasePart") then
634
635
                        v.BrickColor = BrickColor.new(mycolor)
636
637
                end
638
639
        end
640
641
        local mc1 = Vector3.new(mycolor.r,mycolor.g,mycolor.b)
642
643
        local mc2 = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b)
644
645
        w1m.VertexColor,w2m.VertexColor,hm.VertexColor = mc1,mc1,mc2
646
647
        for i,v in pairs(outfitparts) do
648
649
                local mesh = v:FindFirstChild("outfitMesh")
650
651
                if mesh then
652
653
                        mesh.VertexColor = mc2
654
655
                end
656
657
        end
658
659
        pl.Color = mycolor
660
661
        sparkles.SparkleColor = mycolor
662
663
end
664
665
changeColor()
666
667
668
do
669
670
        pcall(function() plr.PlayerGui.fairyColoring:Destroy() end)
671
672
        local scr = Instance.new("ScreenGui",plr.PlayerGui)
673
674
        scr.Name = "fairyColoring"
675
676
        local fr = Instance.new("Frame",scr)
677
678
        fr.Size = UDim2.new(0,-150,0,-65)
679
680
        fr.BackgroundColor3 = Color3.new(1,1,1)
681
682
        fr.BorderColor3 = Color3.new(.05,.05,.05)
683
684
        fr.BackgroundTransparency = .8
685
686
        fr.Position = UDim2.new(1,0,1,scr.Parent:FindFirstChild("PandaHelpNotify") and -20 or 0)
687
688
        fr.ZIndex = 9
689
690
        local am = 75
691
692
        local rval,gval,bval = mycolor.r,mycolor.g,mycolor.b
693
694
        local r = Instance.new("TextButton",fr)
695
696
        r.BackgroundTransparency = 1
697
698
        r.Size = UDim2.new(0,75,0,15)
699
700
        r.Position = UDim2.new(0,5,0,5)
701
702
        r.TextColor3 = Color3.new(1,1,1)
703
704
        r.TextStrokeTransparency = .4
705
706
        for i=1,am do
707
708
                local t = Instance.new("ImageLabel",r)
709
710
                t.BorderSizePixel = 0
711
712
                t.Size = UDim2.new(1/am,0,1,0)
713
714
                t.Position = UDim2.new((i-1)/am,0,0,0)
715
716
                t.Name = i
717
718
                t.ZIndex = 10
719
720
        end
721
722
        local rb = Instance.new("ImageLabel",r)
723
724
        rb.ZIndex = 10
725
726
        rb.Size = UDim2.new(0,2,1,-2)
727
728
        rb.BackgroundColor3 = Color3.new(0,0,0)
729
730
        rb.BackgroundTransparency = .5
731
732
        rb.BorderColor3 = Color3.new(.4,.4,.4)
733
734
        rb.Name = "b"
735
736
        local g = r:Clone()
737
738
        g.Parent = fr
739
740
        g.Position = UDim2.new(0,5,0,25)
741
742
        local b = r:Clone()
743
744
        b.Parent = fr
745
746
        b.Position = UDim2.new(0,5,0,45)
747
748
        r.ZIndex,g.ZIndex,b.ZIndex = 10,10,10
749
750
        local prev = Instance.new("TextButton",fr)
751
752
        prev.Size = UDim2.new(0,55,0,45)
753
754
        prev.Position = UDim2.new(0,90,0,5)
755
756
        prev.ZIndex = 10
757
758
        prev.BorderColor3 = Color3.new(.2,.2,.2)
759
760
        prev.TextColor3 = Color3.new(1,1,1)
761
762
        prev.TextStrokeTransparency = .4
763
764
        prev.TextYAlignment = "Bottom"
765
766
        prev.FontSize = "Size8"
767
768
        prev.TextWrapped = true
769
770
        local res = Instance.new("TextButton",fr)
771
772
        res.Size = UDim2.new(0,55,0,9)
773
774
        res.Position = UDim2.new(0,90,0,51)
775
776
        res.ZIndex = 10
777
778
        res.BorderColor3 = Color3.new(.2,.2,.2)
779
780
        res.BackgroundColor3 = Color3.new(.5,0,0)
781
782
        res.TextColor3 = Color3.new(1,1,1)
783
784
        res.Text = "reset"
785
786
        res.FontSize = "Size8"
787
788
        local mode = 0
789
790
        local function update(set)
791
792
                r.b.Position = UDim2.new(rval,-1,0,1)
793
794
                g.b.Position = UDim2.new(gval,-1,0,1)
795
796
                b.b.Position = UDim2.new(bval,-1,0,1)
797
798
                local col = Color3.new(rval,gval,bval)
799
800
                prev.BackgroundColor3 = mode == 1 and mycolor2 or mycolor
801
802
                prev.Text = ""
803
804
                r.Text = math.floor(rval*255+.5)
805
806
                g.Text = math.floor(gval*255+.5)
807
808
                b.Text = math.floor(bval*255+.5)
809
810
                for i,v in pairs(r:GetChildren()) do
811
812
                        local n = tonumber(v.Name)
813
814
                        if n then
815
816
                                local sc = n/am
817
818
                                v.BackgroundColor3 = Color3.new(sc,gval,bval)
819
820
                        end
821
822
                end
823
824
                for i,v in pairs(g:GetChildren()) do
825
826
                        local n = tonumber(v.Name)
827
828
                        if n then
829
830
                                local sc = n/am
831
832
                                v.BackgroundColor3 = Color3.new(rval,sc,bval)
833
834
                        end
835
836
                end
837
838
                for i,v in pairs(b:GetChildren()) do
839
840
                        local n = tonumber(v.Name)
841
842
                        if n then
843
844
                                local sc = n/am
845
846
                                v.BackgroundColor3 = Color3.new(rval,gval,sc)
847
848
                        end
849
850
                end
851
852
                if set ~= false then
853
854
                        if mode == 0 then
855
856
                                mycolor = col
857
858
                        end
859
860
                        if mode == 1 then
861
862
                                mycolor2 = col
863
864
                        end
865
866
                        changeColor()
867
868
                end
869
870
        end
871
872
        update()
873
874
        local rd,gd,bd = false,false,false
875
876
        r.MouseButton1Down:connect(function(x,y) rd = true rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update()  end)
877
878
        r.MouseButton1Up:connect(function() rd = false end)
879
880
        r.MouseLeave:connect(function() rd = false end)
881
882
        r.MouseMoved:connect(function(x,y) if not rd then return end rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end)
883
884
        g.MouseButton1Down:connect(function(x,y) gd = true gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end)
885
886
        g.MouseButton1Up:connect(function() gd = false end)
887
888
        g.MouseLeave:connect(function() gd = false end)
889
890
        g.MouseMoved:connect(function(x,y) if not gd then return end gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end)
891
892
        b.MouseButton1Down:connect(function(x,y) bd = true bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end)
893
894
        b.MouseButton1Up:connect(function() bd = false end)
895
896
        b.MouseLeave:connect(function() bd = false end)
897
898
        b.MouseMoved:connect(function(x,y) if not bd then return end bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end)
899
900
        res.MouseButton1Click:connect(function()
901
902
                rval,gval,bval = themeColor.Color.r,themeColor.Color.g,themeColor.Color.b
903
904
                update()
905
906
        end)
907
908
909
        local modebtn = Instance.new("TextButton",fr)
910
911
        modebtn.Position = UDim2.new(1,-150,0,-15)
912
913
        modebtn.Size = UDim2.new(0,49,0,14)
914
915
        modebtn.BackgroundColor3 = Color3.new(1,1,0)
916
917
        modebtn.BackgroundTransparency = .6
918
919
        modebtn.TextScaled = true
920
921
        modebtn.Font = 4
922
923
        modebtn.TextColor3 = Color3.new(1,1,1)
924
925
        modebtn.TextStrokeTransparency = .7
926
927
        modebtn.Text = "Body"
928
929
        modebtn.MouseButton1Click:connect(function()
930
931
                mode = (mode+1)%2
932
933
                local col = mode == 1 and mycolor2 or mycolor
934
935
                rval,gval,bval = col.r,col.g,col.b
936
937
                modebtn.Text = mode == 0 and "Body" or "Clothes"
938
939
                update(false)
940
941
        end)
942
943
944
        local outfitbtn = Instance.new("TextButton",fr)
945
946
        outfitbtn.Position = UDim2.new(1,-150,0,-30)
947
948
        outfitbtn.Size = UDim2.new(0,49,0,14)
949
950
        outfitbtn.BackgroundColor3 = Color3.new(1,1,0)
951
952
        outfitbtn.BackgroundTransparency = .6
953
954
        outfitbtn.TextScaled = true
955
956
        outfitbtn.Font = 4
957
958
        outfitbtn.TextColor3 = Color3.new(1,1,1)
959
960
        outfitbtn.TextStrokeTransparency = .7
961
962
        outfitbtn.Text = "Outfit"
963
964
        outfitbtn.MouseButton1Click:connect(function()
965
966
                outfit = (outfit+1)%(#outfits+1)
967
968
                setOutfit()
969
970
        end)
971
972
973
        local sparklebtn = Instance.new("TextButton",fr)
974
975
        sparklebtn.Position = UDim2.new(1,-100,0,-15)
976
977
        sparklebtn.Size = UDim2.new(0,100,0,14)
978
979
        sparklebtn.BackgroundColor3 = Color3.new(0,1,0)
980
981
        sparklebtn.BackgroundTransparency = .6
982
983
        sparklebtn.TextScaled = true
984
985
        sparklebtn.Font = 4
986
987
        sparklebtn.TextColor3 = Color3.new(1,1,1)
988
989
        sparklebtn.TextStrokeTransparency = .7
990
991
        sparklebtn.Text = "Sparkles"
992
993
        sparklebtn.MouseButton1Click:connect(function()
994
995
                senabled = not senabled
996
997
                sparklebtn.BackgroundColor3 = senabled and Color3.new(0,1,0) or Color3.new(1,0,0)
998
999
        end)
1000
1001
        local lightbtn = Instance.new("TextButton",fr)
1002
1003
        lightbtn.Position = UDim2.new(1,-100,0,-30)
1004
1005
        lightbtn.Size = UDim2.new(0,100,0,14)
1006
1007
        lightbtn.BackgroundColor3 = Color3.new(0,1,0)
1008
1009
        lightbtn.BackgroundTransparency = .6
1010
1011
        lightbtn.TextScaled = true
1012
1013
        lightbtn.Font = 4
1014
1015
        lightbtn.TextColor3 = Color3.new(1,1,1)
1016
1017
        lightbtn.TextStrokeTransparency = .7
1018
1019
        lightbtn.Text = "Light"
1020
1021
        lightbtn.MouseButton1Click:connect(function()
1022
1023
                lenabled = not lenabled
1024
1025
                lightbtn.BackgroundColor3 = lenabled and Color3.new(0,1,0) or Color3.new(1,0,0)
1026
1027
        end)
1028
1029
end
1030
1031
1032
1033
local gyro = root:FindFirstChild("RootGyro") or Instance.new("BodyGyro",root)
1034
1035
gyro.maxTorque = Vector3.new()
1036
1037
gyro.Name = "RootGyro"
1038
1039
1040
local vel = root:FindFirstChild("RootVel") or Instance.new("BodyVelocity",root)
1041
1042
vel.maxForce = Vector3.new()
1043
1044
vel.Name = "RootVel"
1045
1046
vel.P = 4000
1047
1048
1049
local flying = false
1050
1051
local state = "idle"
1052
1053
local kd = {}
1054
1055
local humspd = 0
1056
1057
local flyspeed = 0
1058
1059
local flystop = 0
1060
1061
local sitting = false
1062
1063
local holding = false
1064
1065
1066
m.KeyDown:connect(function(k)
1067
1068
        local now = tick()
1069
1070
        kd[k] = now
1071
1072
        if k == " " and not flying then
1073
1074
                pcall(function() sitting:Destroy() end)
1075
1076
                sitting = nil
1077
1078
                state = "fly"
1079
1080
                flying = true
1081
1082
                flydir = (root.CFrame.lookVector*Vector3.new(1,0,1)).unit
1083
1084
        elseif k == " " and state == "fly" then
1085
1086
                flying = false
1087
1088
                state = "idle"
1089
1090
                flystop = tick()
1091
1092
        elseif k == "x" and m.Target and (root.Position-m.Hit.p).magnitude < 20*modelScale then
1093
1094
                local tar = m.Target
1095
1096
                local cf = tar.CFrame:toObjectSpace(m.Hit)
1097
1098
                local siz = tar.Size/2
1099
1100
                local cfr
1101
1102
                local rx,ry,rz = 0,0,0
1103
1104
                local lv = tar.CFrame:vectorToObjectSpace(root.CFrame.lookVector)
1105
1106
                if math.abs(cf.Y-siz.Y) < .03 then
1107
1108
                        cfr = CFrame.new(cf.p + Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
1109
1110
                elseif math.abs(-cf.Y-siz.Y) < .03 then
1111
1112
                        cfr = CFrame.new(cf.p - Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),math.pi)
1113
1114
                elseif math.abs(cf.X-siz.X) < .03 then
1115
1116
                        cfr = CFrame.new(cf.p + Vector3.new(3*modelScale,0,0)) * CFrame.Angles(0,0,-math.pi/2) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
1117
1118
                elseif math.abs(-cf.X-siz.X) < .03 then
1119
1120
                        cfr = CFrame.new(cf.p - Vector3.new(3*modelScale,0,0)) * CFrame.Angles(0,0,math.pi/2) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
1121
1122
                elseif math.abs(cf.Z-siz.Z) < .03 then
1123
1124
                        cfr = CFrame.new(cf.p + Vector3.new(0,0,3*modelScale)) * CFrame.Angles(math.pi/2,0,0) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
1125
1126
                elseif math.abs(-cf.Z-siz.Z) < .03 then
1127
1128
                        cfr = CFrame.new(cf.p - Vector3.new(0,0,3*modelScale)) * CFrame.Angles(-math.pi/2,0,0) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
1129
1130
                end
1131
1132
                if cfr then
1133
1134
                        pcall(function() sitting:Destroy() end)
1135
1136
                        flying = false
1137
1138
                        state = "sit"
1139
1140
                        if m.Target.Anchored then
1141
1142
                                sitting = {tar = tar, cf = cfr}
1143
1144
                        else
1145
1146
                                sitting = weld(tar,root,cfr)
1147
1148
                        end
1149
1150
                end
1151
1152
        end
1153
1154
end)
1155
1156
m.KeyUp:connect(function(k)
1157
1158
        kd[k] = nil
1159
1160
end)
1161
1162
1163
hum.Running:connect(function(spd)
1164
1165
        if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
1166
1167
        humspd = spd
1168
1169
        state = flying and "fly" or (spd < 1 and "idle" or "walk")
1170
1171
end)
1172
1173
hum.Climbing:connect(function(spd)
1174
1175
        if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
1176
1177
        humspd = spd
1178
1179
        state = flying and "fly" or (spd < 1 and "idle" or "walk")
1180
1181
end)
1182
1183
hum.Seated:connect(function(a)
1184
1185
        state = a and "sit" or humspd > 0 and "idle" or "walk"
1186
1187
end)
1188
1189
1190
hum.Changed:connect(function()
1191
1192
        if hum.Jump then
1193
1194
                hum.Jump = false
1195
1196
        end
1197
1198
end)
1199
1200
1201
hum.FreeFalling:connect(function()
1202
1203
        if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
1204
1205
        state = math.abs(tor.Velocity.Y) > 1 and "inair" or state
1206
1207
end)
1208
1209
1210
hum.FallingDown:connect(function(a)
1211
1212
        if not a then return end
1213
1214
        state = "inair"
1215
1216
end)
1217
1218
1219
1220
1221
while true do
1222
1223
        runservice.RenderStepped:wait()
1224
1225
        local cam = workspace.CurrentCamera
1226
1227
        local alpha = .2
1228
1229
        sparkles.Enabled = senabled and flying and tor.Velocity.magnitude > 3
1230
1231
        pl.Enabled = lenabled
1232
1233
        if state ~= "fly" then
1234
1235
                if type(sitting) == "table" then
1236
1237
                        gyro.maxTorque = Vector3.new(1,1,1)*4e6
1238
1239
                        vel.maxForce = Vector3.new(1,1,1)*4e5
1240
1241
                        gyro.cframe = sitting.tar.CFrame * sitting.cf
1242
1243
                        vel.velocity = (gyro.cframe.p-root.Position)*10
1244
1245
                else
1246
1247
                        gyro.maxTorque,vel.maxForce = Vector3.new(),Vector3.new()
1248
1249
                end
1250
1251
        end
1252
1253
        if sitting then
1254
1255
                state = "sit"
1256
1257
        end
1258
1259
        tw.MaxVelocity,rh.MaxVelocity,lh.MaxVelocity,rs.MaxVelocity,ls.MaxVelocity,nk.MaxVelocity = 0,0,0,0,0,0
1260
1261
        tw.CurrentAngle,rh.CurrentAngle,lh.CurrentAngle,rs.CurrentAngle,ls.CurrentAngle,nk.CurrentAngle = 0,0,0,0,0,0
1262
1263
1264
        local hasRobe = outfit == 1
1265
1266
1267
        if state == "idle" then
1268
1269
                hum.PlatformStand = false
1270
1271
                local breathing = math.sin(tick()*2)
1272
1273
                local tilt = .02 + breathing*.03
1274
1275
                w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
1276
1277
                w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
1278
1279
1280
                tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
1281
1282
                rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt,hasRobe and 0 or -.1,hasRobe and 0 or .06),alpha)
1283
1284
                lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt,hasRobe and 0 or .1,hasRobe and 0 or -.06),alpha)
1285
1286
                rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt,0,.1),alpha)
1287
1288
                ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt,0,-.1),alpha)
1289
1290
                nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.05-.03,0,0),alpha)
1291
1292
        elseif state == "inair" then
1293
1294
                hum.PlatformStand = false
1295
1296
                local wings = math.sin(tick()*80)
1297
1298
                w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6)
1299
1300
                w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6)
1301
1302
                local alpha = .15
1303
1304
                local tilt = .05
1305
1306
                local wavey = math.sin(tick()*3)
1307
1308
                tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
1309
1310
                rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+wavey*.1,0,hasRobe and 0 or .02),alpha)
1311
1312
                lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-wavey*.1,0,hasRobe and 0 or -.02),alpha)
1313
1314
                rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt-wavey*.07,0,.01),alpha)
1315
1316
                ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+wavey*.07,0,-.01),alpha)
1317
1318
                nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+.2,0,0),alpha)
1319
1320
        elseif state == "walk" then
1321
1322
                hum.PlatformStand = false
1323
1324
                local walking = math.sin(tick()*25) 
1325
1326
                local breathing = math.sin(tick()*2)
1327
1328
                local tilt = -.03-breathing*.02+walking*.01
1329
1330
                alpha = .6
1331
1332
                w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.05+breathing*.01+walking*.05,0),alpha)
1333
1334
                w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.05-breathing*.01+walking*.05,0),alpha)
1335
1336
1337
                tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,-walking*.08,0),alpha)
1338
1339
                rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+walking*.3,0,hasRobe and 0 or .02),alpha)
1340
1341
                lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-walking*.3,0,hasRobe and 0 or -.02),alpha)
1342
1343
                rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.05-walking*.25,0,.01),alpha)
1344
1345
                ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.05+walking*.25,0,-.01),alpha)
1346
1347
                nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04,walking*.07,0),alpha)
1348
1349
        elseif state == "sit" then
1350
1351
                hum.Sit = false
1352
1353
                hum.PlatformStand = true
1354
1355
                local breathing = math.sin(tick()*2)
1356
1357
                local upvec = root.CFrame:vectorToWorldSpace(Vector3.new(0,1,0))
1358
1359
                if upvec.Y > .4 then
1360
1361
                        local tilt = -.55+breathing*.015
1362
1363
                        w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
1364
1365
                        w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
1366
1367
                        tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-1.7,0)*modelScale,alpha)
1368
1369
                        rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or .6),alpha)
1370
1371
                        lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or -.6),alpha)
1372
1373
                        rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.3,0,-.1)*CFrame.Angles(hasRobe and .3 or 0,hasRobe and .2 or 0,hasRobe and -.2 or 0)+(hasRobe and 0 or 1)*Vector3.new(-.85,-.25,-.25)*modelScale,alpha)
1374
1375
                        ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.3,0,.1)*CFrame.Angles(hasRobe and .3 or 0,hasRobe and -.2 or 0,hasRobe and .2 or 0)+(hasRobe and 0 or 1)*Vector3.new(.85,-.25,-.25)*modelScale,alpha)
1376
1377
                        nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04-.03,0,math.sin(tick()*4)*.06),alpha)
1378
1379
                else -- wallhug
1380
1381
                        local breathing = math.sin(tick()*5)
1382
1383
                        local tilt = -1.55+breathing*.015
1384
1385
                        w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
1386
1387
                        w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
1388
1389
                        tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-2.5,0)*modelScale,alpha)
1390
1391
                        rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(.2,0,hasRobe and 0 or .5)+Vector3.new(0,hasRobe and 0 or .2,0)*modelScale,alpha)
1392
1393
                        lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(.2,0,hasRobe and 0 or -.5)+Vector3.new(0,hasRobe and 0 or .2,0)*modelScale,alpha)
1394
1395
                        rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(2.9,0,.8)+Vector3.new(-.2,.4,0)*modelScale,alpha)
1396
1397
                        ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(2.9,0,-.8)+Vector3.new(.2,.4,0)*modelScale,alpha)
1398
1399
                        nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(breathing*.04+.7,0,0),alpha)
1400
1401
                end
1402
1403
        elseif state == "fly" then
1404
1405
                hum.PlatformStand = true
1406
1407
                gyro.maxTorque = Vector3.new(1,1,1)*4e6
1408
1409
                vel.maxForce = Vector3.new(1,1,1)*4e5
1410
1411
1412
                local velocity = Vector3.new((kd.d and 1 or 0)+(kd.a and -1 or 0),0,(kd.s and 1 or 0)+(kd.w and -1 or 0))
1413
1414
                velocity = cam.CoordinateFrame:vectorToWorldSpace(velocity)
1415
1416
                local maxspeed = 40-(velocity.magnitude > 0 and velocity.unit.Y*20 or 0)
1417
1418
                if velocity.magnitude > 0 then
1419
1420
                        flyspeed = lerp(flyspeed,maxspeed,.1)
1421
1422
                        flydir = flydir:Lerp(velocity.unit,.4).unit
1423
1424
                        hoverheight = nil
1425
1426
                else
1427
1428
                        flyspeed = lerp(flyspeed,0,.3)
1429
1430
                        flydir = (flydir*Vector3.new(1,0,1)).unit
1431
1432
                        hoverheight = hoverheight or root.Position.Y
1433
1434
                end
1435
1436
                vel.velocity = flydir.unit * flyspeed
1437
1438
                if hoverheight then
1439
1440
                        vel.velocity = vel.velocity + Vector3.new(0,hoverheight-root.Position.Y,0)
1441
1442
                end
1443
1444
                gyro.cframe = CFrame.new(Vector3.new(),flydir*Vector3.new(1,0,1))
1445
1446
1447
                rl.CanCollide,ll.CanCollide = true,true
1448
1449
1450
                local wings = math.sin(tick()*80)
1451
1452
                w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6)
1453
1454
                w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6)
1455
1456
                local alpha = .15
1457
1458
                local flytilt = (flyspeed/maxspeed)
1459
1460
                local tilt = flytilt*-1.4 + math.asin(gyro.cframe:vectorToObjectSpace(flydir).unit.Y)
1461
1462
                local wavey = math.sin(tick()*6)
1463
1464
                tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
1465
1466
                rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(wavey*.1,hasRobe and 0 or -.08,hasRobe and 0 or .1),alpha)
1467
1468
                lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-wavey*.1,hasRobe and 0 or .08,hasRobe and 0 or -.1),alpha)
1469
1470
                rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-wavey*.15,-.08,.1),alpha)
1471
1472
                ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(wavey*.15,.08,-.1),alpha)
1473
1474
                nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt*.8,0,0),alpha)
1475
1476
        end
1477
1478
end