-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathModule.luau
More file actions
1359 lines (1062 loc) · 38.4 KB
/
Module.luau
File metadata and controls
1359 lines (1062 loc) · 38.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- \\ Krypton Reanimate, Author: @xyzkade/@gelatekforever. https://github.com/KadeTheExploiter/Krypton/ //
-- || 1.8, Let's experiment!
-- // Eyelashes, Lipstick, Facemask, Crystal Gel, Deluxe Spa Package!~...
local game = game
local TableClear = table.clear
local TaskWait = task.wait
local TableInsert = table.insert
local CFrameNew = CFrame.new
local Vector3New = Vector3.new
local Sine = math.sin
local Cosine = math.cos
local ClockTPOT = os.clock
local Hats = {}
local ReanimateConfig = KryptonConfiguration or {}
local DontStartYet = ReanimateConfig.DontStartYet -- Patchfix for private testing
local FlingTable, ReturnOnDeath, RigName, WaitTime, RigScale, DestroyHeightOffset, RadiusOffset, FlingMethod, FlingVelocity, RefitCount
local Flinging, OverlayFakeCharacter, NoBodyNearby, PermanentDeath, Reclaim, AntisleepPower, Refit, AntiVoiding, NoCollisions, SetPlayerChar, ToolFlinging, LimitHatsPerLimb, DisableCharacterScripts
local GetPropertyChangedSignal = game.GetPropertyChangedSignal
local FindFirstChildWhichIsA = game.FindFirstChildWhichIsA
local FindFirstChildOfClass = game.FindFirstChildOfClass
local GetDescendants = game.GetDescendants
local FindFirstChild = game.FindFirstChild
local IsDescendantOf = game.IsDescendantOf
local WaitForChild = game.WaitForChild
local GetChildren = game.GetChildren
local Destroy = game.Destroy
local Clone = game.Clone
local Close = game.Close
local IsA = game.IsA
local ReverseSleep = Vector3.zero
local FailsafeOffset = CFrame.new(1, 6, 1)
local FailsafeVelocity = Vector3New(0,120,30)
local FlingVelocity = Vector3New(16000, 16000, 16000)
local PreSimulationEvent = nil
local ReclaimInstance = nil
local LargestInstance = nil
local FlingInstance = nil
local PlayTrack = nil
local StopTrack = nil
local AdjustSpeed = nil
local CurrentAnimation = nil
local AnimationThread = nil
local MaxInteger = 2147483646
local SinedClock = 1
local TotalHats = 0
local BindableEvent = Instance.new("BindableEvent")
local FallAnimation = Instance.new("Animation")
local CamCustomType = Enum.CameraType.Custom
local CameraLockType = Enum.MouseBehavior.LockCenter
local Tables = {}
local function CreateTable(Content: {any} | nil): {any}
local NewTable = Content or {}
table.insert(Tables, NewTable)
return NewTable
end
local identifyexecutor = identifyexecutor
local replicatesignal = replicatesignal
local setscriptable = setscriptable
local HatsWithDifferentAligns = CreateTable()
local FlingableTargets = CreateTable()
local TempSignals = CreateTable()
local RBXSignals = CreateTable()
local Blacklist = CreateTable()
local HatsInUse = CreateTable()
local JointsOffsets = CreateTable()
local Joints = CreateTable()
local FrameTimes = {}
local FrameData = {}
local InsertService: InsertService = FindFirstChildOfClass(game, "InsertService")
local Workspace: Workspace = FindFirstChildOfClass(game, "Workspace")
local Players: Players = FindFirstChildOfClass(game, "Players")
local RunService: RunService = FindFirstChildOfClass(game, "RunService")
local StarterGui: StarterGui = FindFirstChildOfClass(game, "StarterGui")
local UserInputService: UserInputService = FindFirstChildOfClass(game, "UserInputService")
local SignalConnect = Close['Connect']
local SignalWait = Close['Wait']
local SignalOnce = Close['Once']
local Disconnect = SignalOnce(Close, function() end)['Disconnect']
local CanChangeSimRadius, _ = pcall(GetPropertyChangedSignal, Players.LocalPlayer, "SimulationRadius")
local FallenPartsDestroyHeight = Workspace['FallenPartsDestroyHeight']
local FallenPartsDestroyHeightOffset
local Terrain = FindFirstChildOfClass(Workspace, "Terrain")
local Camera = Workspace['CurrentCamera']
local PreviousCameraCFrame = Camera['CFrame']
local Player = Players['LocalPlayer']
local GetNetworkPing = Player['GetNetworkPing']
local Humanoid, Animator, RootPart, CFrameBackup
-- // RunTime: Creating FakeRig
local Character = Player['Character'] or SignalWait(Player['CharacterAdded'])
if Character.Name ~= Player.Name then
return
end
local Descendants = CreateTable(GetDescendants(Character))
local FakeRig, FakeHumanoid, FakeAnimator, FakeRoot, FakeRigChildren
local QuickHumanoid = Instance.new("Humanoid")
local QuickAnimator = Instance.new("Animator", QuickHumanoid)
local SetStateEnabled = QuickHumanoid['SetStateEnabled']
local ChangeState = QuickHumanoid['ChangeState']
local LoadAnimation = QuickAnimator['LoadAnimation']
local GetPlayingAnimationTracks = QuickAnimator['GetPlayingAnimationTracks']
local Move = QuickHumanoid['Move']
local SetCoreGuiEnabled = StarterGui['SetCoreGuiEnabled']
local IsGrounded = Character.PrimaryPart['IsGrounded']
local BreakJoints = Character['BreakJoints']
local SetCore = StarterGui['SetCore']
Destroy(QuickHumanoid)
-- // RunTime: Functions
-- // Instances
local function SetDescendantProperties(Table: {}, Class: string, Property: string, Value: any, Check: boolean)
if not Check then
return
end
for _, Any in Table do
if IsA(Any, Class) then
Any[Property] = Value
end
end
end
local function WaitForInstance(Parent: Instance, Class: string, Name: string | nil, Cooldown: number | nil)
local CurTime = Cooldown or 0
while 1 > CurTime do
for _, Any in GetChildren(Parent) do
if IsA(Any, Class) and (not Name or Any.Name == Name) then
return Any
end
end
CurTime += TaskWait()
end
end
local function ExtractNumbers(String: string | number)
local ToString = tostring(String)
return string.match(ToString, "%d+")
end
local function GetFirstPart(Parent: Instance) : Part
return FindFirstChildOfClass(Parent, "Part") or WaitForChild(Parent, "Handle", 1)
end
local function GetFirstWeld(Parent: Instance) : Weld
return FindFirstChild(Parent, "AccessoryWeld") or FindFirstChildOfClass(Parent, "Weld")
end
local function DestroyWeld(Parent: Instance)
local Weld = GetFirstWeld(Parent)
if Weld then
Weld:Destroy()
end
end
-- // Accessories
local function GetAccoutrementData(Accoutrement: Accoutrement)
local Handle = FindFirstChild(Accoutrement, "Handle")
if IsA(Handle, "MeshPart") then
return {Handle.MeshId, Handle.TextureID}
else
local Mesh = FindFirstChildOfClass(Handle, "SpecialMesh")
if Mesh then
return {Mesh.MeshId, Mesh.TextureId}
end
end
end
local function FindAccoutrement(Parent: Instance, Texture: string | number, Mesh: string | number, Name: string)
local InputMeshNumber = ExtractNumbers(Mesh)
local InputTextureNumber = ExtractNumbers(Texture)
for _, Accoutrement in GetChildren(Parent) do
if not (IsA(Accoutrement, "Accoutrement") and Accoutrement.Name == Name) then
continue
end
local AccounteremtData = GetAccoutrementData(Accoutrement)
if not AccounteremtData then
continue
end
local MeshNumber = ExtractNumbers(AccounteremtData[1])
local TextureNumber = ExtractNumbers(AccounteremtData[2])
if MeshNumber == InputMeshNumber and TextureNumber == InputTextureNumber then
return Accoutrement
end
end
end
local function RecreateAccoutrement(Accoutrement)
local FakeAccoutrement = Clone(Accoutrement)
local FakeHandle = GetFirstPart(FakeAccoutrement)
DestroyWeld(FakeHandle)
FakeHandle.Transparency = 1
local FakeAttachment = FindFirstChildOfClass(FakeHandle, "Attachment")
local RigAttachmentName = FakeAttachment and FakeAttachment.Name or ""
local RigAttachment = FindFirstChild(FakeRig, RigAttachmentName, true)
local FakeHandleWeld = Instance.new("Weld")
FakeHandleWeld.Name = "AccessoryWeld"
FakeHandleWeld.Part0 = FakeHandle
FakeHandleWeld.C0 = FakeAttachment.CFrame
if RigAttachment then
FakeHandleWeld.C1 = RigAttachment.CFrame
FakeHandleWeld.Part1 = RigAttachment.Parent
else
FakeHandleWeld.Part1 = FindFirstChild(FakeRig, "Head")
end
FakeHandleWeld.Parent = FakeHandle
FakeAccoutrement.Parent = FakeRig
return FakeAccoutrement
end
local function ProcessAccoutrement(Accoutrement: Accoutrement, Function)
if not Accoutrement or table.find(Blacklist, Accoutrement) then
return
end
TableInsert(Blacklist, Accoutrement)
TotalHats += 1
local Handle = GetFirstPart(Accoutrement)
if Handle and not HatsInUse[Handle] then
Function(Handle)
end
end
-- unused until celery fixes shp or setscriptable
local function SetAccoutrementsState(Table: {Accoutrement}, State: any)
for _, Accoutrement in Table do
if IsA(Accoutrement, "Accoutrement") then
setscriptable(Accoutrement, "BackendAccoutrementState", true)
Accoutrement.BackendAccoutrementState = State
end
end
end
local function FinalizeAccoutrements()
for _, Value in HatsWithDifferentAligns do
local AlignedAccessory = FindAccoutrement(Character, Value[1], Value[2], Value[3])
ProcessAccoutrement(AlignedAccessory, function(Handle)
local Part1 = Value[4]
if Part1 and Part1.Parent then
HatsInUse[Handle] = { Part1, Value[5] or CFrame.identity }
end
end)
end
for _, Any in GetChildren(FakeRig) do
if IsA(Any, "Accessory") then
Destroy(Any)
end
local Name = Any.Name
local Data = Hats[Name]
if Data then
for Index = 1, #Data do
local HatInfo = Data[Index]
if not HatInfo then
return
end
local FoundAccoutrement = FindAccoutrement(
Character, HatInfo['Texture'], HatInfo['Mesh'], HatInfo['Name']
)
ProcessAccoutrement(FoundAccoutrement, function(Handle)
HatsInUse[Handle] = {Any, HatInfo['Offset'] or CFrame.identity}
end)
end
if LimitHatsPerLimb then
continue
end
end
end
for _, Accoutrement in GetChildren(Character) do
if IsA(Accoutrement, "Accoutrement") then
ProcessAccoutrement(Accoutrement, function(Handle)
local FakeAccessory = RecreateAccoutrement(Accoutrement)
HatsInUse[Handle] = { GetFirstPart(FakeAccessory), CFrame.identity }
end)
end
end
end
-- // Camera
local function UpdateCameraCFrame()
PreviousCameraCFrame = Camera['CFrame']
SignalWait(RunService['PreRender'])
Camera.CFrame = PreviousCameraCFrame
end
local function ChangeCameraSubject()
Camera.CameraSubject = FakeHumanoid
UpdateCameraCFrame()
end
local function ShiftlockRootOffset()
if UserInputService.MouseBehavior == CameraLockType then
local Position = FakeRoot['Position']
local CamLookVector = Camera.CFrame['LookVector'] --* 1
FakeRoot.CFrame = CFrame.lookAt(Position, Position + Vector3New(CamLookVector.X, 0, CamLookVector.Z))
end
end
-- // Flinging
local function FlingModels()
for _, Model in FlingableTargets do
local PrimaryPart = Model['PrimaryPart']
if not PrimaryPart or not FlingInstance then
continue
end
for Tick = 1, 16 do
local LinearVelocity = PrimaryPart['AssemblyLinearVelocity']
FlingInstance.CFrame = CFrameNew(
PrimaryPart.Position + LinearVelocity * GetNetworkPing(Player) * 30
)
FlingInstance.AssemblyLinearVelocity = FlingVelocity
if LinearVelocity.Magnitude > 125 then
break
end
end
end
TableClear(FlingableTargets)
end
-- // Teleport
local function ReplicateSignal(Any: Instance | RBXScriptSignal, Signal: string)
if not replicatesignal then
return
end
local _Signal = Any[Signal]
return replicatesignal(_Signal)
end
local function GetRandomRadius() : Vector3
return Vector3New(
math.random(-RadiusOffset, RadiusOffset), 0.5, math.random(-RadiusOffset, RadiusOffset)
)
end
local function GetRightOffset() : CFrame
local Offset = FakeRoot['Position'] + GetRandomRadius()
local AxisY = NoBodyNearby and FallenPartsDestroyHeightOffset - 0.25 or Offset.Y
return CFrameNew(Offset.X, AxisY, Offset.Z)
end
local function ArePlayersNearby(Offset: CFrame) : boolean
local Position = Offset.Position
local IsChecked -- Checks for multiple cases, duh?
for _, Part in Workspace:GetPartBoundsInRadius(Position, 10) do
local Model = Part.Parent
if FindFirstChildOfClass(Model, "Humanoid") then
if not (Model == Character and Model == FakeRig) then
IsChecked = true
end
end
end
return IsChecked
end
local function BringCharacter()
local ExtraOffset = CFrame.identity
local TeleportCFrame = GetRightOffset()
local Time = 0
if Flinging then
FlingModels()
end
while ArePlayersNearby(TeleportCFrame) do
TeleportCFrame = GetRightOffset() * ExtraOffset
end
if Animator and NoBodyNearby then
Workspace.FallenPartsDestroyHeight = 0/0
local Animate = WaitForInstance(Character, "LocalScript", "Animate", 0.16)
local IsR15 = Humanoid.RigType.Name == "R15"
if Animate then
Animate.Disabled = true
end
for _, Track in next, GetPlayingAnimationTracks(Animator) do
StopTrack(Track)
end
local AnimationId = IsR15 and "507767968" or "180436148"
FallAnimation.AnimationId = "rbxassetid://"..AnimationId
if IsR15 then
ExtraOffset = CFrame.Angles(1145.92,0,0)
ChangeState(Humanoid, Enum.HumanoidStateType.Physics)
end
local Animation = LoadAnimation(Animator, FallAnimation)
Animation.Priority = 5
task.spawn(PlayTrack, Animation, 0, 1, 1)
end
while WaitTime > Time do
RootPart.AssemblyLinearVelocity = Vector3.zero
RootPart.CFrame = TeleportCFrame
Time += TaskWait()
end
end
local function SetHumanoidStates()
FakeRoot.AssemblyLinearVelocity = Vector3.zero
FakeRoot.AssemblyAngularVelocity = Vector3.zero
SetCore(StarterGui, "ResetButtonCallback", BindableEvent)
SetCoreGuiEnabled(StarterGui, Enum.CoreGuiType.Health, false)
SetStateEnabled(Humanoid, Enum.HumanoidStateType.Seated, false)
SetStateEnabled(Humanoid, Enum.HumanoidStateType.Dead, true)
BreakJoints(Character)
if replicatesignal then
ReplicateSignal(Humanoid, "ServerBreakJoints")
else
ChangeState(Humanoid, Enum.HumanoidStateType.Dead)
end
Workspace.FallenPartsDestroyHeight = FallenPartsDestroyHeight
end
local function ApplyCharacter()
if not SetPlayerChar then
return
end
if NoBodyNearby then
repeat task.wait() until not FindFirstChild(Character, "HumanoidRootPart")
end
task.wait(WaitTime * 2)
Player.Character = FakeRig
end
-- // Ownership
local function RefitRig()
TotalHats = 0
SetDescendantProperties(FakeRigChildren, "BasePart", "Transparency", 0.5, true)
SetDescendantProperties(FakeRigChildren, "BasePart", "BrickColor", BrickColor.new("Forest green"), true)
ReplicateSignal(Player, "ConnectDiedSignalBackend")
end
local function SetSimulationRadius(Value: number)
if CanChangeSimRadius then
Player.SimulationRadius = Value
end
end
local function CheckAge(Part: Instance): boolean
return Part and not IsGrounded(Part) and Part.ReceiveAge == 0
end
local function GetAdjustedAxis(Y: number): number
if Y > 27 then
return Y
end
return 27
end
local function GetCurrentPrimaryPart()
return Character.PrimaryPart or FindFirstChildWhichIsA(Character, "BasePart", true)
end
local function CreateSelectionBox(BasePart: BasePart): SelectionBox
local Selection = FindFirstChild(BasePart, "SelectionBox")
return Selection or Instance.new("SelectionBox", BasePart)
end
local function ReclaimHandle(Handle)
if not Handle or not Reclaim then
return
end
ReclaimInstance = Handle
local Selection = CreateSelectionBox(ReclaimInstance)
local Timeout = 0
local WaitTime = 0.5
LargestInstance = GetCurrentPrimaryPart()
while WaitTime > Timeout do
Selection.Adornee = not CheckAge(ReclaimInstance) and ReclaimInstance or nil
if not LargestInstance or not LargestInstance.Parent then
LargestInstance = GetCurrentPrimaryPart()
end
if CheckAge(ReclaimInstance) then
ReclaimInstance.AssemblyLinearVelocity = FailsafeVelocity
ReclaimInstance = nil
break
end
Timeout = TaskWait()
end
end
local function CalculateVelocity(Part0: BasePart, Part1: BasePart): Vector3
local BaseVelocity = Part1['AssemblyLinearVelocity']
local ScaledVelocity = BaseVelocity * Part0.Size['Magnitude']
local LookVector = Part1.CFrame['LookVector'] * BaseVelocity['Unit']
local LookVectorYAxis = GetAdjustedAxis(LookVector.Y + BaseVelocity.Y) + SinedClock
return Vector3New(
ScaledVelocity.X + LookVector.X,
LookVectorYAxis,
ScaledVelocity.Z + LookVector.Z
)
end
local function SetPhysicalProperties(Table: {[BasePart]: {BasePart | CFrame}}, ApplyVelocity: boolean)
for Handle, Data in Table do
local Part1, Offset = Data[1], Data[2]
if not Part1 then
return
end
Handle.Massless = true
if ApplyVelocity then
Handle.AssemblyLinearVelocity = CalculateVelocity(Handle, Part1)
Handle.AssemblyAngularVelocity = Part1.AssemblyAngularVelocity
end
if not CheckAge(Handle) then
ReclaimHandle(Handle)
else
local ReclaimInstanceOffset = ReclaimInstance and ReclaimInstance.CFrame
local BaseCFrame
if not ReclaimInstance then
BaseCFrame = Part1.CFrame * Offset
elseif ReclaimInstance and Handle ~= LargestInstance then
BaseCFrame = LargestInstance.CFrame * FailsafeOffset
elseif LargestInstance == Handle and ReclaimInstance and ReclaimInstanceOffset.Y > FallenPartsDestroyHeightOffset + 200 then
BaseCFrame = ReclaimInstanceOffset
end
Handle.CFrame = BaseCFrame + ReverseSleep
end
end
end
-- // Cancel
local function StopAnimationThread()
if AnimationThread then
task.cancel(AnimationThread)
end
if CurrentAnimation then
Destroy(CurrentAnimation)
end
for Name, Joint in Joints do
Joint.Transform = JointsOffsets[Name]
end
table.clear(FrameTimes)
table.clear(FrameData)
if FakeRig then
local Animate = FindFirstChild(FakeRig, "Animate")
if Animate then
Animate.Enabled = ReanimateConfig.Animations
end
end
end
local function CancelScript()
if not IsDescendantOf(FakeRig, Workspace) or not FakeRoot then
return
end
local RootCFrame = FakeRoot.CFrame
ReplicateSignal(Player, "ConnectDiedSignalBackend")
ChangeState(FakeHumanoid, Enum.HumanoidStateType.Dead)
Disconnect(PreSimulationEvent)
SignalWait(Player.CharacterAdded)
StopAnimationThread()
Character = Player.Character
-- memory free up real fe bypass
for Key, Signal in RBXSignals do
Disconnect(Signal)
RBXSignals[Key] = nil
end
for _, Table in Tables do
TableClear(Table)
end
Camera.CameraSubject = Character
SetCore(StarterGui, "ResetButtonCallback", true)
Destroy(FakeRig)
FakeRig = nil
FakeHumanoid = nil
FakeRoot = nil
FakeRigChildren = nil
if ReturnOnDeath then
local Root = WaitForInstance(Character, "Part", "HumanoidRootPart")
if Root then
Root.CFrame = RootCFrame
end
end
end
-- // Runit
local function OnParentChange()
if not IsDescendantOf(FakeRig, Workspace) then
CancelScript()
end
end
local function OnPreRender()
ShiftlockRootOffset()
SetPhysicalProperties(HatsInUse, false)
if Camera then
if Camera.CameraSubject ~= FakeHumanoid then
ChangeCameraSubject()
end
if Camera.CameraType ~= CamCustomType then
Camera.CameraType = CamCustomType
end
end
if AntiVoiding and FakeRoot.Position.Y < FallenPartsDestroyHeightOffset then
FakeRoot.CFrame = CFrameBackup
FakeRoot.AssemblyLinearVelocity = Vector3.zero
FakeRoot.AssemblyAngularVelocity = Vector3.zero
end
end
local function OnPostSimulation()
SetPhysicalProperties(HatsInUse, true)
ShiftlockRootOffset()
if FakeHumanoid and Humanoid then
FakeHumanoid.Jump = Humanoid.Jump
Move(FakeHumanoid, Humanoid.MoveDirection)
end
if Refit then
for Index, Accessory in Blacklist do
if not Accessory or Accessory and not Accessory.Parent then
table.remove(Blacklist, Index)
end
end
if TotalHats > RefitCount and #Blacklist < TotalHats - RefitCount then
RefitRig()
end
end
end
local function OnPreSimulation()
SetDescendantProperties(Descendants, "BasePart", "CanCollide", false, true)
SetDescendantProperties(FakeRigChildren, "BasePart", "CanCollide", false, NoCollisions)
SetSimulationRadius(MaxInteger)
SinedClock = Sine(ClockTPOT())
ReverseSleep = Vector3New(0.005 * Sine(ClockTPOT() * 100), 0, 0.005 * Cosine(ClockTPOT() * 100)) * AntisleepPower
end
local function OnCharacterAdded(NewCharacter: Model)
UpdateCameraCFrame()
if NewCharacter == FakeRig then
return
end
-- Clear few, not every.
TableClear(HatsInUse)
TableClear(Descendants)
TableClear(FakeRigChildren)
TableClear(Blacklist)
TotalHats = 0
Character = NewCharacter
Humanoid = WaitForInstance(Character, "Humanoid", nil)
RootPart = WaitForInstance(Character, "Part", "HumanoidRootPart")
Animator = WaitForInstance(Humanoid, "Animator", nil)
SetDescendantProperties(Descendants, "LocalScript", "Disabled", true, DisableCharacterScripts)
if not Humanoid and not RootPart then
error(not Humanoid and "Humanoid" or "HumanoidRootPart", "Not found inside Character.")
end
if PermanentDeath then
RootPart.CFrame = FakeRoot.CFrame * CFrameNew(0, 2 * RigScale, 0)
ReplicateSignal(Player, "ConnectDiedSignalBackend")
TaskWait(Players.RespawnTime + 0.15)
end
BringCharacter()
SetHumanoidStates()
UpdateCameraCFrame()
FinalizeAccoutrements()
ApplyCharacter()
FakeRigChildren = GetChildren(FakeRig)
SetDescendantProperties(FakeRigChildren, "BasePart", "Transparency", OverlayFakeCharacter and 0.5 or 1, true)
SetDescendantProperties(FakeRigChildren, "BasePart", "BrickColor", BrickColor.new("Black"), true)
end
local DefaultHats = {
["Right Arm"] = {
{Texture = "14255544465", Mesh = "14255522247", Name = "RARM", Offset = CFrame.Angles(0, 0, math.rad(90))},
{Texture = "4391374782", Mesh = "4324138105", Name = "MeshPartAccessory", Offset = CFrame.new(0.05,0,0) * CFrame.Angles(math.rad(-90), 0, math.rad(90))},
{Texture = "4645402630", Mesh = "3030546036", Name = "International Fedora", Offset = CFrame.new(0.05,0,0) * CFrame.Angles(math.rad(90), 0, math.rad(-90))},
{Texture = "135650240593878", Mesh = "137702817952968", Name = "Accessory (RArmNoob)", Offset = CFrame.Angles(0, 0, math.rad(90))},
{Texture = "130809869695496", Mesh = "139733645770094", Name = "Accessory (RARM)", Offset = CFrame.Angles(0, 0, math.rad(90))},
},
["Left Arm"] = {
{Texture = "14255544465", Mesh = "14255522247", Name = "LARM", Offset = CFrame.Angles(0, 0, math.rad(90))},
{Texture = "4154474807", Mesh = "4154474745", Name = "MeshPartAccessory", Offset = CFrame.new(-0.05,0,0) * CFrame.Angles(math.rad(90), 0, math.rad(-90))},
{Texture = "3650139425", Mesh = "3030546036", Name = "International Fedora", Offset = CFrame.new(-0.05,0,0) * CFrame.Angles(math.rad(-90), 0, math.rad(90))},
{Texture = "135650240593878", Mesh = "137702817952968", Name = "Accessory (LArmNoob)", Offset = CFrame.Angles(0, 0, math.rad(90))},
{Texture = "71060417496309", Mesh = "105141400603933", Name = "Accessory (LARM)", Offset = CFrame.Angles(0, 0, math.rad(90))},
},
["Right Leg"] = {
{Texture = "17374768001", Mesh = "17374767929", Name = "Accessory (RARM)", Offset = CFrame.Angles(0, 0, math.rad(90))},
{Texture = "3360974849", Mesh = "3030546036", Name = "InternationalFedora", Offset = CFrame.Angles(math.rad(90), 0, math.rad(-90))},
{Texture = "4622077774", Mesh = "3030546036", Name = "International Fedora", Offset = CFrame.Angles(math.rad(-90), 0, math.rad(90))},
{Texture = "3360978739", Mesh = "3030546036", Name = "InternationalFedora", Offset = CFrame.Angles(math.rad(-90), 0, math.rad(90))},
{Texture = "11159284657", Mesh = "11159370334", Name = "Unloaded head", Offset = CFrame.Angles(0, 0, math.rad(90))},
{Texture = "136752500636691", Mesh = "125405780718494", Name = "Accessory (RArm)", Offset = CFrame.Angles(0, 0, math.rad(90))},
},
["Left Leg"] = {
{Texture = "17374768001", Mesh = "17374767929", Name = "Accessory (LARM)", Offset = CFrame.Angles(0, 0, math.rad(90))},
{Texture = "3033903209", Mesh = "3030546036", Name = "InternationalFedora", Offset = CFrame.Angles(math.rad(90), 0, math.rad(90))},
{Texture = "3860099469", Mesh = "3030546036", Name = "InternationalFedora", Offset = CFrame.Angles(math.rad(-90), 0, math.rad(-90))},
{Texture = "3409604993", Mesh = "3030546036", Name = "InternationalFedora", Offset = CFrame.Angles(math.rad(-90), 0, math.rad(-90))},
{Texture = "11263219250", Mesh = "11263221350", Name = "MeshPartAccessory", Offset = CFrame.Angles(0, 0, math.rad(90))},
{Texture = "136752500636691", Mesh = "125405780718494", Name = "Accessory (LArm)", Offset = CFrame.Angles(0, 0, math.rad(90))},
},
["Torso"] = {
{Texture = "13415110780", Mesh = "13421774668", Name = "MeshPartAccessory", Offset = CFrame.identity},
{Texture = "17617036903", Mesh = "17617036887", Name = "Accessory (1x1x1x1's Transparent Torso)", Offset = CFrame.identity},
{Texture = "125975972015302", Mesh = "126825022897778", Name = "Accessory (TorsoNoob)", Offset = CFrame.identity},
{Texture = "4819722776", Mesh = "4819720316", Name = "MeshPartAccessory", Offset = CFrame.Angles(0, 0, math.rad(-15))}
},
}
local function ValidateSetting(Name, Default, OtherTable)
local Table = OtherTable or ReanimateConfig
local Original = Table[Name]
return Original ~= nil and Original or Default
end
local function StartReanimate()
ReanimateConfig = KryptonConfiguration or {}
FlingTable = ReanimateConfig.Flinging or {}
RigName = ValidateSetting("RigName", "Evolution, it must've passed you by.")
WaitTime = ValidateSetting("WaitTime", 0.251)
RigScale = ValidateSetting("FakeRigScale", 1)
RefitCount = ValidateSetting("RefitHatCount", 2)
RadiusOffset = ValidateSetting("TeleportOffsetRadius", 21)
DestroyHeightOffset = ValidateSetting("DestroyHeightOffset", 100)
Refit = ValidateSetting("Refit", false)
AntiVoiding = ValidateSetting("AntiVoiding", false)
DontStartYet = ValidateSetting("DontStartYet", false)
NoBodyNearby = ValidateSetting("NoBodyNearby", false)
NoCollisions = ValidateSetting("NoCollisions", false) or Flinging
ToolFlinging = ValidateSetting("ToolFlinging", false)
SetPlayerChar = ValidateSetting("SetCharacter", false)
AntisleepPower = ValidateSetting("AntisleepPower", 1.025)
OverlayFakeCharacter = ValidateSetting("OverlayFakeCharacter", false)
ReturnOnDeath = ValidateSetting("ReturnOnDeath", false)
Flinging = ValidateSetting("Flinging", "false", FlingTable)
FlingVelocity = ValidateSetting("Velocity", 8000, FlingTable)
LimitHatsPerLimb = ValidateSetting("LimitHatsPerLimb", false)
FlingMethod = ValidateSetting("MethodUsed", "Hat", FlingTable)
DisableCharacterScripts = ValidateSetting("DisableCharacterScripts", false)
PermanentDeath = replicatesignal and ValidateSetting("PermanentDeath", false)
Reclaim = NoBodyNearby and PermanentDeath and ValidateSetting("Reclaim", false)
Hats = ValidateSetting("Hats", {})
FallenPartsDestroyHeightOffset = FallenPartsDestroyHeight + DestroyHeightOffset or 100
Character = Player['Character'] or SignalWait(Player['CharacterAdded'])
if not PermanentDeath and ReanimateConfig.Refit then
Refit = nil
end
if not NoBodyNearby and FlingMethod == ("Hat" or "HatTouch") then
Flinging = nil
end
if Character.Name ~= Player.Name then
return
end
if not Hats[1] or ReanimateConfig.AccessoryFallbackDefaults then
local Types = { Name = "string", Texture = "string", Mesh = "string", Offset = "CFrame" }
for Name, Data in DefaultHats do
local HatsData = Hats[Name]
local Flagged = nil
if HatsData and typeof(HatsData) == "table" then
for _, Hat in HatsData do
for Key, Type in Types do
if typeof(Hat[Key]) ~= Type then
Flagged = true
break
end
end
end
else
Flagged = true
end
if Flagged then
Hats[Name] = table.clone(Data)
end
end
end
Descendants = CreateTable(GetDescendants(Character))
FakeRig = Players:CreateHumanoidModelFromDescription(Instance.new("HumanoidDescription"), Enum.HumanoidRigType.R6)
FakeHumanoid = FindFirstChildOfClass(FakeRig, "Humanoid")
FakeAnimator = FindFirstChildOfClass(FakeHumanoid, "Animator")
FakeRoot = FindFirstChild(FakeRig, "HumanoidRootPart")
FakeRigChildren = CreateTable(GetChildren(FakeRig))
Humanoid = WaitForInstance(Character, "Humanoid", nil)
RootPart = WaitForInstance(Character, "Part", "HumanoidRootPart")
Animator = WaitForInstance(Humanoid, "Animator", nil)
CFrameBackup = RootPart.CFrame
FakeRig.Parent = Terrain
FakeRoot.CFrame = CFrameBackup
Player.ReplicationFocus = FakeRoot
FakeRigChildren = GetChildren(FakeRig)
PreSimulationEvent = SignalConnect(RunService["PreSimulation"], OnPreSimulation) -- need to define ts
TableInsert(RBXSignals, SignalConnect(GetPropertyChangedSignal(FakeRig, "Parent"), OnParentChange))
TableInsert(RBXSignals, SignalConnect(GetPropertyChangedSignal(Camera, "CameraSubject"), ChangeCameraSubject))
TableInsert(RBXSignals, SignalConnect(Player["CharacterAdded"], OnCharacterAdded))
TableInsert(RBXSignals, SignalConnect(RunService["PostSimulation"], OnPostSimulation))
TableInsert(RBXSignals, SignalConnect(RunService["PreRender"], OnPreRender))
TableInsert(RBXSignals, SignalConnect(BindableEvent["Event"], CancelScript))
TableInsert(RBXSignals, PreSimulationEvent)
for _, Track in next, GetPlayingAnimationTracks(Animator) do
StopTrack = Track['Stop']
PlayTrack = Track['Play']
AdjustSpeed = Track['AdjustSpeed']
break
end
if WaitTime < 0.16 then
WaitTime = 0
end
if RigName then
FakeRig.Name = RigName
end
if RigScale then
FakeRoot.CFrame = FakeRoot.CFrame * CFrameNew(0, 2 * RigScale, 0)
FakeRig:ScaleTo(RigScale)
end
for _, Any in GetDescendants(FakeRig) do
if IsA(Any, "Motor6D") then
local Name = Any.Part1.Name
JointsOffsets[Name] = Any.Transform
Joints[Name] = Any
end
end
if ReanimateConfig.Animations then
local Animate = Instance.new("LocalScript")
Animate.Name = "Animate"
Animate.Parent = FakeRig
local function AddAnimation(ID)
local Animation = Instance.new("Animation")
Animation.AnimationId = ID
return Animation
end
local AnimationsToggled = true
local JumpAnimTime = 0
local Current = {
Speed = 0,
Animation = "",
Instance = nil,
AnimTrack = nil,
KeyframeHandler = nil,
}
local AnimationTable = {
Idle = AddAnimation("http://www.roblox.com/asset/?id=180435571"),
Walk = AddAnimation("http://www.roblox.com/asset/?id=180426354"),
Run = AddAnimation("Run.xml"),
Jump = AddAnimation("http://www.roblox.com/asset/?id=125750702"),
Fall = AddAnimation("http://www.roblox.com/asset/?id=180436148"),