@rbxts/falldown 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/init.luau ADDED
@@ -0,0 +1,1629 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
4
+ local RunService = _services.RunService
5
+ local Workspace = _services.Workspace
6
+ local Players = _services.Players
7
+ local PhysicsService = _services.PhysicsService
8
+ local HttpService = _services.HttpService
9
+ local Signal = TS.import(script, TS.getModule(script, "@rbxts", "beacon").out).Signal
10
+ local _r6J
11
+ do
12
+ _r6J = setmetatable({}, {
13
+ __tostring = function()
14
+ return "_r6J"
15
+ end,
16
+ })
17
+ _r6J.__index = _r6J
18
+ function _r6J.new(...)
19
+ local self = setmetatable({}, _r6J)
20
+ return self:constructor(...) or self
21
+ end
22
+ function _r6J:constructor()
23
+ end
24
+ _r6J.RightShoulder = {
25
+ Attachment0Info = {
26
+ TakeoverTitle = "Torso",
27
+ Offset = CFrame.new(1.00019073, 0.879000187, -0.000190734863, 0, 0, 1, 0, 1, -0, -1, 0, 0),
28
+ },
29
+ Attachment1Info = {
30
+ TakeoverTitle = "Right Arm",
31
+ Offset = CFrame.new(-0.499907017, 0.879375935, -0.000343322754, 5.64381423e-07, 0.00116295868, 0.999999404, 0.00033581481, 0.999999285, -0.00116295891, -1, 0.000335815246, 1.73842267e-07),
32
+ },
33
+ Restitution = 0,
34
+ MaxFrictionTorque = 0,
35
+ LimitsEnabled = true,
36
+ TwistLimitsEnabled = true,
37
+ UpperAngle = 90,
38
+ TwistUpperAngle = 45,
39
+ TwistLowerAngle = -45,
40
+ }
41
+ _r6J.LeftShoulder = {
42
+ Attachment0Info = {
43
+ TakeoverTitle = "Torso",
44
+ Offset = CFrame.new(-1.00031185, 0.893874645, 0.00327682495, 5.77419996e-08, -0.0014789335, 0.999998927, 0.00195833528, 0.99999702, 0.00147893059, -0.999998093, 0.00195833319, 2.95398945e-06),
45
+ },
46
+ Attachment1Info = {
47
+ TakeoverTitle = "Left Arm",
48
+ Offset = CFrame.new(0.494401991, 0.894001007, 0.00263214111, 9.31322575e-10, -7.08860171e-09, 1, -9.31322575e-10, 1, 7.08860171e-09, -1, -9.31322575e-10, 9.31322575e-10),
49
+ },
50
+ Restitution = 0,
51
+ MaxFrictionTorque = 0,
52
+ LimitsEnabled = true,
53
+ TwistLimitsEnabled = true,
54
+ UpperAngle = 90,
55
+ TwistUpperAngle = 45,
56
+ TwistLowerAngle = -45,
57
+ }
58
+ _r6J.LeftHip = {
59
+ Attachment0Info = {
60
+ TakeoverTitle = "Torso",
61
+ Offset = CFrame.new(-0.499999762, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
62
+ },
63
+ Attachment1Info = {
64
+ TakeoverTitle = "Left Leg",
65
+ Offset = CFrame.new(2.38418579e-07, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
66
+ },
67
+ Restitution = 0,
68
+ MaxFrictionTorque = 0,
69
+ LimitsEnabled = true,
70
+ TwistLimitsEnabled = true,
71
+ UpperAngle = 90,
72
+ TwistUpperAngle = 45,
73
+ TwistLowerAngle = -45,
74
+ }
75
+ _r6J.RightHip = {
76
+ Attachment0Info = {
77
+ TakeoverTitle = "Torso",
78
+ Offset = CFrame.new(0.500000238, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
79
+ },
80
+ Attachment1Info = {
81
+ TakeoverTitle = "Right Leg",
82
+ Offset = CFrame.new(2.38418579e-07, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
83
+ },
84
+ Restitution = 0,
85
+ MaxFrictionTorque = 0,
86
+ LimitsEnabled = true,
87
+ TwistLimitsEnabled = true,
88
+ UpperAngle = 90,
89
+ TwistUpperAngle = 45,
90
+ TwistLowerAngle = -45,
91
+ }
92
+ _r6J.Neck = {
93
+ Attachment0Info = {
94
+ TakeoverTitle = "Torso",
95
+ Offset = CFrame.new(2.38418579e-07, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
96
+ },
97
+ Attachment1Info = {
98
+ TakeoverTitle = "Head",
99
+ Offset = CFrame.new(2.38418579e-07, -0.5, 0, 0, -0.0012902373, 0.999999166, 0.00128811458, 0.999998331, 0.00129023625, -0.999999166, 0.00128811353, 1.66197344e-06),
100
+ },
101
+ Restitution = 0,
102
+ MaxFrictionTorque = 0,
103
+ LimitsEnabled = true,
104
+ TwistLimitsEnabled = true,
105
+ UpperAngle = 45,
106
+ TwistUpperAngle = 45,
107
+ TwistLowerAngle = -45,
108
+ }
109
+ _r6J.Root = {
110
+ Part0Title = "HumanoidRootPart",
111
+ Part1Title = "Torso",
112
+ }
113
+ end
114
+ local _r15J
115
+ do
116
+ _r15J = setmetatable({}, {
117
+ __tostring = function()
118
+ return "_r15J"
119
+ end,
120
+ })
121
+ _r15J.__index = _r15J
122
+ function _r15J.new(...)
123
+ local self = setmetatable({}, _r15J)
124
+ return self:constructor(...) or self
125
+ end
126
+ function _r15J:constructor()
127
+ end
128
+ _r15J.LeftWrist = {
129
+ Attachment0Info = {
130
+ TakeoverTitle = "LeftLowerArm",
131
+ Offset = CFrame.new(0, -0.600000143, 0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
132
+ },
133
+ Attachment1Info = {
134
+ TakeoverTitle = "LeftHand",
135
+ Offset = CFrame.new(0, 0.100000001, 0, 0, -5.96046448e-08, 1, -1, 0, 0, 0, -1, -5.96046448e-08),
136
+ },
137
+ Restitution = 0,
138
+ MaxFrictionTorque = 0,
139
+ LimitsEnabled = true,
140
+ TwistLimitsEnabled = true,
141
+ UpperAngle = 15,
142
+ TwistUpperAngle = 1,
143
+ TwistLowerAngle = -1,
144
+ }
145
+ _r15J.RightWrist = {
146
+ Attachment0Info = {
147
+ TakeoverTitle = "RightLowerArm",
148
+ Offset = CFrame.new(0, -0.600000143, -0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
149
+ },
150
+ Attachment1Info = {
151
+ TakeoverTitle = "RightHand",
152
+ Offset = CFrame.new(0, 0.100000001, 0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
153
+ },
154
+ Restitution = 0,
155
+ MaxFrictionTorque = 0,
156
+ LimitsEnabled = true,
157
+ TwistLimitsEnabled = true,
158
+ UpperAngle = 45,
159
+ TwistUpperAngle = 1,
160
+ TwistLowerAngle = -1,
161
+ }
162
+ _r15J.LeftElbow = {
163
+ Attachment0Info = {
164
+ TakeoverTitle = "LeftUpperArm",
165
+ Offset = CFrame.new(0, -0.230000004, 0, -1, -5.96046377e-08, 0, 5.96046377e-08, -1, 0, 0, 0, 1),
166
+ },
167
+ Attachment1Info = {
168
+ TakeoverTitle = "LeftLowerArm",
169
+ Offset = CFrame.new(0, 0.219999999, 0, -1, -5.96046377e-08, 0, 5.96046377e-08, -1, 0, 0, 0, 1),
170
+ },
171
+ Restitution = 0,
172
+ LimitsEnabled = true,
173
+ UpperAngle = 0,
174
+ LowerAngle = -120,
175
+ }
176
+ _r15J.RightElbow = {
177
+ Attachment0Info = {
178
+ TakeoverTitle = "RightUpperArm",
179
+ Offset = CFrame.new(0, -0.230000004, 0, -1, 8.74227766e-08, 0, -8.74227766e-08, -1, 0, 0, 0, 1),
180
+ },
181
+ Attachment1Info = {
182
+ TakeoverTitle = "RightLowerArm",
183
+ Offset = CFrame.new(0, 0.219999999, 0, -1, 8.74227766e-08, 0, -8.74227766e-08, -1, 0, 0, 0, 1),
184
+ },
185
+ Restitution = 0,
186
+ LimitsEnabled = true,
187
+ UpperAngle = 0,
188
+ LowerAngle = -120,
189
+ }
190
+ _r15J.LeftAnkle = {
191
+ Attachment0Info = {
192
+ TakeoverTitle = "LeftLowerLeg",
193
+ Offset = CFrame.new(0, -0.750000179, 0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
194
+ },
195
+ Attachment1Info = {
196
+ TakeoverTitle = "LeftFoot",
197
+ Offset = CFrame.new(0, 0.100000001, 0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
198
+ },
199
+ Restitution = 0,
200
+ MaxFrictionTorque = 0,
201
+ LimitsEnabled = true,
202
+ TwistLimitsEnabled = true,
203
+ UpperAngle = 15,
204
+ TwistUpperAngle = 5,
205
+ TwistLowerAngle = -5,
206
+ }
207
+ _r15J.LeftShoulder = {
208
+ Attachment0Info = {
209
+ TakeoverTitle = "UpperTorso",
210
+ Offset = CFrame.new(-1.5, 0.350312829, 0, -1, 0, 0, 0, 1, 0, 0, 0, -1),
211
+ },
212
+ Attachment1Info = {
213
+ TakeoverTitle = "LeftUpperArm",
214
+ Offset = CFrame.new(0, 0.25, 0, -1, 0, 0, 0, 1, 0, 0, 0, -1),
215
+ },
216
+ Restitution = 0,
217
+ MaxFrictionTorque = 0,
218
+ LimitsEnabled = true,
219
+ TwistLimitsEnabled = true,
220
+ UpperAngle = 45,
221
+ TwistUpperAngle = 180,
222
+ TwistLowerAngle = -90,
223
+ }
224
+ _r15J.Neck = {
225
+ Attachment0Info = {
226
+ TakeoverTitle = "UpperTorso",
227
+ Offset = CFrame.new(0, 0.800000072, 0, 0, 5.96046377e-08, -1, 1, 0, 0, 0, -1, -5.96046377e-08),
228
+ },
229
+ Attachment1Info = {
230
+ TakeoverTitle = "Head",
231
+ Offset = CFrame.new(0, -0.5, 0, 0, 5.96046377e-08, -1, 1, 0, 0, 0, -1, -5.96046377e-08),
232
+ },
233
+ Restitution = 0,
234
+ MaxFrictionTorque = 0,
235
+ LimitsEnabled = true,
236
+ TwistLimitsEnabled = true,
237
+ UpperAngle = 30,
238
+ TwistUpperAngle = 45,
239
+ TwistLowerAngle = -45,
240
+ }
241
+ _r15J.RightShoulder = {
242
+ Attachment0Info = {
243
+ TakeoverTitle = "UpperTorso",
244
+ Offset = CFrame.new(1.5, 0.349999994, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
245
+ },
246
+ Attachment1Info = {
247
+ TakeoverTitle = "RightUpperArm",
248
+ Offset = CFrame.new(0, 0.25, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
249
+ },
250
+ Restitution = 0,
251
+ MaxFrictionTorque = 0,
252
+ LimitsEnabled = true,
253
+ TwistLimitsEnabled = true,
254
+ UpperAngle = 45,
255
+ TwistUpperAngle = 180,
256
+ TwistLowerAngle = -90,
257
+ }
258
+ _r15J.LeftKnee = {
259
+ Attachment0Info = {
260
+ TakeoverTitle = "LeftUpperLeg",
261
+ Offset = CFrame.new(0, -0.300000012, 0, -1, 0, 0, 0, -1, 5.96046377e-08, 0, 5.96046377e-08, 1),
262
+ },
263
+ Attachment1Info = {
264
+ TakeoverTitle = "LeftLowerLeg",
265
+ Offset = CFrame.new(0, 0.25, 0, -1, 0, 0, 0, -1, -8.9406953e-08, 0, -8.9406953e-08, 1),
266
+ },
267
+ Restitution = 0,
268
+ LimitsEnabled = true,
269
+ UpperAngle = 120,
270
+ LowerAngle = 0,
271
+ }
272
+ _r15J.RightAnkle = {
273
+ Attachment0Info = {
274
+ TakeoverTitle = "RightLowerLeg",
275
+ Offset = CFrame.new(0, -0.750000179, 0, 0, -4.37113883e-08, 1, -1, 0, 0, -0, -1, -4.37113883e-08),
276
+ },
277
+ Attachment1Info = {
278
+ TakeoverTitle = "RightFoot",
279
+ Offset = CFrame.new(0, 0.100000001, 0, 0, -4.37113883e-08, 1, -1, 0, 0, -0, -1, -4.37113883e-08),
280
+ },
281
+ Restitution = 0,
282
+ MaxFrictionTorque = 0,
283
+ LimitsEnabled = true,
284
+ TwistLimitsEnabled = true,
285
+ UpperAngle = 5,
286
+ TwistUpperAngle = 5,
287
+ TwistLowerAngle = -5,
288
+ }
289
+ _r15J.Waist = {
290
+ Attachment0Info = {
291
+ TakeoverTitle = "LowerTorso",
292
+ Offset = CFrame.new(0, 0.199999988, 0, 1, 5.96046377e-08, -0, -5.96046377e-08, 1, 0, 0, 0, 1),
293
+ },
294
+ Attachment1Info = {
295
+ TakeoverTitle = "UpperTorso",
296
+ Offset = CFrame.new(0, -0.800000072, 0, 1, 5.96046377e-08, -0, -5.96046377e-08, 1, 0, 0, 0, 1),
297
+ },
298
+ Restitution = 0,
299
+ LimitsEnabled = true,
300
+ UpperAngle = 15,
301
+ LowerAngle = -60,
302
+ }
303
+ _r15J.LeftHip = {
304
+ Attachment0Info = {
305
+ TakeoverTitle = "LowerTorso",
306
+ Offset = CFrame.new(-0.5, -0.5, 0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
307
+ },
308
+ Attachment1Info = {
309
+ TakeoverTitle = "LeftUpperLeg",
310
+ Offset = CFrame.new(0, 0.200000003, 0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
311
+ },
312
+ Restitution = 0,
313
+ MaxFrictionTorque = 0,
314
+ LimitsEnabled = true,
315
+ TwistLimitsEnabled = true,
316
+ UpperAngle = 30,
317
+ TwistUpperAngle = 30,
318
+ TwistLowerAngle = -30,
319
+ }
320
+ _r15J.RightHip = {
321
+ Attachment0Info = {
322
+ TakeoverTitle = "LowerTorso",
323
+ Offset = CFrame.new(0.5, -0.5, 0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
324
+ },
325
+ Attachment1Info = {
326
+ TakeoverTitle = "RightUpperLeg",
327
+ Offset = CFrame.new(0, 0.200000003, 0, 0, -5.96046377e-08, 1, -1, 0, 0, 0, -1, -5.96046377e-08),
328
+ },
329
+ Restitution = 0,
330
+ MaxFrictionTorque = 0,
331
+ LimitsEnabled = true,
332
+ TwistLimitsEnabled = true,
333
+ UpperAngle = 30,
334
+ TwistUpperAngle = 30,
335
+ TwistLowerAngle = -30,
336
+ }
337
+ _r15J.RightKnee = {
338
+ Attachment0Info = {
339
+ TakeoverTitle = "RightUpperLeg",
340
+ Offset = CFrame.new(0, -0.300000012, 0, -1, 0, 0, 0, -1, 5.96046448e-08, 0, 5.96046448e-08, 1),
341
+ },
342
+ Attachment1Info = {
343
+ TakeoverTitle = "RightLowerLeg",
344
+ Offset = CFrame.new(0, 0.25, 0, -1, 0, 0, 0, -1, -5.96046519e-08, 0, -5.96046519e-08, 1),
345
+ },
346
+ Restitution = 0,
347
+ LimitsEnabled = true,
348
+ UpperAngle = 120,
349
+ LowerAngle = 0,
350
+ }
351
+ _r15J.Root = {
352
+ Part0Title = "HumanoidRootPart",
353
+ Part1Title = "LowerTorso",
354
+ }
355
+ end
356
+ --[[
357
+ *
358
+ * Interface representing an active ragdoll instance. Users receive pre-constructed instances from {@linkcode Falldown.RagdollCharacter}.
359
+ * @interface
360
+ * @see {@linkcode Falldown}
361
+ * @see {@linkcode Falldown.RagdollCharacter}
362
+
363
+ ]]
364
+ local Falldown
365
+ local ActiveRagdoll
366
+ do
367
+ ActiveRagdoll = setmetatable({}, {
368
+ __tostring = function()
369
+ return "ActiveRagdoll"
370
+ end,
371
+ })
372
+ ActiveRagdoll.__index = ActiveRagdoll
373
+ function ActiveRagdoll.new(...)
374
+ local self = setmetatable({}, ActiveRagdoll)
375
+ return self:constructor(...) or self
376
+ end
377
+ function ActiveRagdoll:constructor(character, objectiveHeight, standFadeTime, humanoid, humanoidRootPart, leftTouchObj, rightTouchObj, jointDestructionInfo, proxyGroupId, bodypartGroupId, proxyMapping, automaticDuration, getupFront, getupBack)
378
+ self.Destroyed = Signal.new()
379
+ self.Ended = Signal.new()
380
+ character.Destroying:Once(function()
381
+ self.CharacterDead = true
382
+ table.clear(self._jointDestructionInfo)
383
+ self.Destroyed:Fire()
384
+ self.Destroyed:Destroy()
385
+ self.Ended:Destroy()
386
+ end)
387
+ humanoid.Died:Once(function()
388
+ self.CharacterDead = true
389
+ end)
390
+ self.CharacterDead = humanoid.Health <= 0
391
+ self.Owner = Players:GetPlayerFromCharacter(character)
392
+ self.Character = character
393
+ self.Humanoid = humanoid
394
+ self.HumanoidRootPart = humanoidRootPart
395
+ self.LeftTouchPart = leftTouchObj
396
+ self.RightTouchPart = rightTouchObj
397
+ self.GetupFrontAnimation = getupFront
398
+ self.GetupBackAnimation = getupBack
399
+ if getupFront then
400
+ getupFront:Play(0, 1, 0)
401
+ getupFront:Stop()
402
+ end
403
+ if getupBack then
404
+ getupBack:Play(0, 1, 0)
405
+ getupBack:Stop()
406
+ end
407
+ self._automaticDuration = automaticDuration
408
+ self._jointDestructionInfo = jointDestructionInfo
409
+ self._proxyGroupId = proxyGroupId
410
+ self._bodypartGroupId = bodypartGroupId
411
+ self._proxyMapping = proxyMapping
412
+ self._objectiveHeight = objectiveHeight
413
+ self._standFadeTime = standFadeTime
414
+ local _condition = self._automaticDuration
415
+ if _condition ~= 0 and _condition == _condition and _condition then
416
+ _condition = not self.CharacterDead
417
+ end
418
+ if _condition ~= 0 and _condition == _condition and _condition then
419
+ delay(self._automaticDuration, function()
420
+ self:Destroy()
421
+ end)
422
+ end
423
+ end
424
+ function ActiveRagdoll:GetVerticalDirection(dir)
425
+ local unitDir = dir.Unit
426
+ local dotUp = unitDir:Dot(Vector3.yAxis)
427
+ local dotDown = unitDir:Dot(Vector3.yAxis * (-1))
428
+ if dotUp > dotDown then
429
+ return 0
430
+ else
431
+ return 1
432
+ end
433
+ end
434
+ function ActiveRagdoll:AddVelocity(velocity, mode)
435
+ if self.Character.Parent == nil then
436
+ return nil
437
+ end
438
+ if #self._jointDestructionInfo == 0 or next(self._proxyMapping) == nil then
439
+ return nil
440
+ end
441
+ local velocityDirection = velocity.Unit
442
+ local velocityMagnitude = velocity.Magnitude
443
+ if mode == Falldown.VelocityMode.RootOnly then
444
+ local _assemblyLinearVelocity = self.HumanoidRootPart.AssemblyLinearVelocity
445
+ local _velocity = velocity
446
+ self.HumanoidRootPart.AssemblyLinearVelocity = _assemblyLinearVelocity + _velocity
447
+ elseif mode == Falldown.VelocityMode.AllEqual then
448
+ for _, descendant in self.Character:GetDescendants() do
449
+ if descendant:IsA("BasePart") then
450
+ local _assemblyLinearVelocity = descendant.AssemblyLinearVelocity
451
+ local _velocity = velocity
452
+ descendant.AssemblyLinearVelocity = _assemblyLinearVelocity + _velocity
453
+ end
454
+ end
455
+ elseif mode == Falldown.VelocityMode.SplitEqual then
456
+ local counter = 0
457
+ for _, descendant in self.Character:GetDescendants() do
458
+ if descendant:IsA("BasePart") then
459
+ counter += 1
460
+ end
461
+ end
462
+ local perPartVelocity = velocityMagnitude / counter
463
+ local perPartVelocityVector = velocityDirection * perPartVelocity
464
+ for _, descendant in self.Character:GetDescendants() do
465
+ if descendant:IsA("BasePart") then
466
+ descendant.AssemblyLinearVelocity = descendant.AssemblyLinearVelocity + perPartVelocityVector
467
+ end
468
+ end
469
+ elseif mode == Falldown.VelocityMode.RandomMax then
470
+ for _, descendant in self.Character:GetDescendants() do
471
+ if descendant:IsA("BasePart") then
472
+ local randomFactor = math.random(0, velocityMagnitude)
473
+ local partVelocity = velocityDirection * randomFactor
474
+ descendant.AssemblyLinearVelocity = descendant.AssemblyLinearVelocity + partVelocity
475
+ end
476
+ end
477
+ else
478
+ return error("Invalid velocity mode specified.")
479
+ end
480
+ end
481
+ function ActiveRagdoll:AddRandomVelocity(maxVelocity)
482
+ if self.Character.Parent == nil then
483
+ return nil
484
+ end
485
+ if #self._jointDestructionInfo == 0 or next(self._proxyMapping) == nil then
486
+ return nil
487
+ end
488
+ for _, descendant in self.Character:GetDescendants() do
489
+ if descendant:IsA("BasePart") then
490
+ local randomVelocity = Vector3.new(math.random(-maxVelocity, maxVelocity), math.random(-maxVelocity, maxVelocity), math.random(-maxVelocity, maxVelocity))
491
+ descendant.AssemblyLinearVelocity = descendant.AssemblyLinearVelocity + randomVelocity
492
+ end
493
+ end
494
+ end
495
+ function ActiveRagdoll:Destroy(overrideDeathLock)
496
+ if self.Character.Parent == nil then
497
+ return nil
498
+ end
499
+ if self.CharacterDead and not overrideDeathLock then
500
+ return nil
501
+ end
502
+ if #self._jointDestructionInfo == 0 or next(self._proxyMapping) == nil then
503
+ return nil
504
+ end
505
+ local clonedCharacter = Instance.new("Model")
506
+ clonedCharacter.Name = "Falldown_FadeClone_Temp"
507
+ local humanoid = Instance.new("Humanoid")
508
+ local animator = humanoid:FindFirstChildOfClass("Animator")
509
+ humanoid.RigType = self.Humanoid.RigType
510
+ humanoid.RequiresNeck = false
511
+ humanoid.AutoRotate = false
512
+ if animator then
513
+ for _, anim in animator:GetPlayingAnimationTracks() do
514
+ anim:Stop()
515
+ end
516
+ animator:Destroy()
517
+ end
518
+ local cloneCG = HttpService:GenerateGUID(false)
519
+ PhysicsService:RegisterCollisionGroup(cloneCG)
520
+ PhysicsService:CollisionGroupSetCollidable(cloneCG, "Default", false)
521
+ PhysicsService:CollisionGroupSetCollidable(cloneCG, self._bodypartGroupId, false)
522
+ PhysicsService:CollisionGroupSetCollidable(cloneCG, cloneCG, false)
523
+ local cloneToRealMap = {}
524
+ local originalTransparencies = {}
525
+ for _, descendant in self.Character:GetDescendants() do
526
+ if descendant:IsA("BasePart") then
527
+ local partClone = descendant:Clone()
528
+ partClone.Anchored = true
529
+ partClone.CollisionGroup = cloneCG
530
+ partClone.CFrame = descendant.CFrame
531
+ cloneToRealMap[partClone] = descendant
532
+ local _transparency = descendant.Transparency
533
+ originalTransparencies[descendant] = _transparency
534
+ for _1, partDesc in partClone:GetDescendants() do
535
+ if partDesc:IsA("JointInstance") or partDesc:IsA("Constraint") or partDesc:IsA("Attachment") then
536
+ partDesc:Destroy()
537
+ elseif partDesc:IsA("Decal") then
538
+ local _arg0 = descendant:FindFirstChild(partDesc.Name)
539
+ local _transparency_1 = partDesc.Transparency
540
+ originalTransparencies[_arg0] = _transparency_1
541
+ end
542
+ end
543
+ partClone.Parent = clonedCharacter
544
+ elseif descendant:IsA("Clothing") then
545
+ local clothingClone = descendant:Clone()
546
+ clothingClone.Parent = clonedCharacter
547
+ end
548
+ end
549
+ humanoid.Parent = clonedCharacter
550
+ clonedCharacter.Parent = Workspace
551
+ for thing, originalTransparency in originalTransparencies do
552
+ thing.Transparency = 1
553
+ end
554
+ for _, info in self._jointDestructionInfo do
555
+ info.Replaced.Enabled = true
556
+ info.Constraint:Destroy()
557
+ if info.NoCol then
558
+ info.NoCol:Destroy()
559
+ end
560
+ if info.Attachment0 then
561
+ info.Attachment0:Destroy()
562
+ end
563
+ if info.Attachment1 then
564
+ info.Attachment1:Destroy()
565
+ end
566
+ end
567
+ table.clear(self._jointDestructionInfo)
568
+ for _, descendant in self.Character:GetDescendants() do
569
+ if descendant:IsA("BasePart") then
570
+ if descendant.CollisionGroup == self._bodypartGroupId then
571
+ descendant.CollisionGroup = "Default"
572
+ end
573
+ descendant.AssemblyLinearVelocity = Vector3.zero
574
+ descendant.AssemblyAngularVelocity = Vector3.zero
575
+ end
576
+ end
577
+ self.Humanoid.PlatformStand = false
578
+ self.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
579
+ self.HumanoidRootPart.Anchored = true
580
+ --const thisAnimator = this.Humanoid.FindFirstChildOfClass("Animator");
581
+ --if (thisAnimator) {
582
+ -- for (const anim of thisAnimator.GetPlayingAnimationTracks()) {
583
+ -- anim.Stop(0);
584
+ -- }
585
+ --}
586
+ for _, proxyPart in self._proxyMapping do
587
+ proxyPart:Destroy()
588
+ end
589
+ table.clear(self._proxyMapping)
590
+ local facing = ActiveRagdoll:GetVerticalDirection(self.HumanoidRootPart.CFrame.LookVector)
591
+ local activeAnimation = nil
592
+ local _cFrame = self.LeftTouchPart.CFrame
593
+ local _cFrame_1 = CFrame.new(0, -(self.LeftTouchPart.Size.Y / 2), 0)
594
+ local leftToes = _cFrame * _cFrame_1
595
+ local _cFrame_2 = self.RightTouchPart.CFrame
596
+ local _cFrame_3 = CFrame.new(0, -(self.RightTouchPart.Size.Y / 2), 0)
597
+ local rightToes = _cFrame_2 * _cFrame_3
598
+ local castParams = RaycastParams.new()
599
+ castParams.FilterDescendantsInstances = { self.Character }
600
+ castParams.FilterType = Enum.RaycastFilterType.Exclude
601
+ castParams.IgnoreWater = true
602
+ local nearStandPoint = leftToes.Position:Lerp(rightToes.Position, 0.5)
603
+ local _vector3 = Vector3.new(0, 5, 0)
604
+ local standCast = Workspace:Raycast(nearStandPoint + _vector3, Vector3.new(0, -50, 0), castParams)
605
+ local _result = standCast
606
+ if _result ~= nil then
607
+ _result = _result.Position
608
+ end
609
+ local _condition = _result
610
+ if not _condition then
611
+ _condition = nearStandPoint
612
+ end
613
+ local standPoint = _condition
614
+ local _result_1 = standCast
615
+ if _result_1 ~= nil then
616
+ _result_1 = _result_1.Normal
617
+ end
618
+ local _condition_1 = _result_1
619
+ if not _condition_1 then
620
+ _condition_1 = Vector3.yAxis
621
+ end
622
+ local groundNormal = _condition_1
623
+ local __objectiveHeight = self._objectiveHeight
624
+ local _arg0 = groundNormal * __objectiveHeight
625
+ local centerPoint = standPoint + _arg0
626
+ local gravity = Vector3.new(0, -1, 0)
627
+ local gDot = gravity:Dot(groundNormal)
628
+ local _arg0_1 = groundNormal * gDot
629
+ local downhill = gravity - _arg0_1
630
+ if downhill.Magnitude < 1e-3 then
631
+ downhill = Vector3.new(0, 0, 1)
632
+ end
633
+ downhill = downhill.Unit
634
+ local flatDirection = (function()
635
+ local head = self.Character:FindFirstChild("Head")
636
+ local towardHead = if (head and head:IsA("BasePart")) then head.Position - standPoint else self.HumanoidRootPart.Position - standPoint
637
+ local dot = towardHead:Dot(groundNormal)
638
+ local _arg0_2 = groundNormal * dot
639
+ local along = towardHead - _arg0_2
640
+ if along.Magnitude < 1e-3 then
641
+ local look = self.HumanoidRootPart.CFrame.LookVector
642
+ local d = look:Dot(groundNormal)
643
+ local _arg0_3 = groundNormal * d
644
+ along = look - _arg0_3
645
+ end
646
+ if along.Magnitude < 1e-3 then
647
+ along = downhill
648
+ end
649
+ if along:Dot(downhill) < 0 then
650
+ along = along * (-1)
651
+ end
652
+ return along.Unit
653
+ end)()
654
+ local right = groundNormal:Cross(flatDirection)
655
+ if right.Magnitude < 1e-3 then
656
+ right = groundNormal:Cross(Vector3.zAxis)
657
+ if right.Magnitude < 1e-3 then
658
+ right = groundNormal:Cross(Vector3.xAxis)
659
+ end
660
+ end
661
+ right = right.Unit
662
+ local forwardOnSurface = right:Cross(groundNormal).Unit
663
+ if facing == 0 then
664
+ activeAnimation = self.GetupBackAnimation
665
+ else
666
+ activeAnimation = self.GetupFrontAnimation
667
+ end
668
+ task.spawn(function()
669
+ if activeAnimation then
670
+ local targetCFrame = CFrame.fromMatrix(centerPoint, forwardOnSurface, groundNormal)
671
+ self.Character:PivotTo(targetCFrame)
672
+ activeAnimation:Play(0, 1, 0)
673
+ while not activeAnimation.IsPlaying do
674
+ task.wait()
675
+ end
676
+ activeAnimation.TimePosition = 0.0
677
+ task.wait()
678
+ local activeLerp = 0
679
+ task.spawn(function()
680
+ while true do
681
+ local dt = task.wait(1 / 60)
682
+ local lerpAlpha = activeLerp + (dt / math.min(self._standFadeTime, activeAnimation.Length))
683
+ local ended = false
684
+ if lerpAlpha >= 1 then
685
+ ended = true
686
+ lerpAlpha = 1
687
+ end
688
+ for partClone, realPart in cloneToRealMap do
689
+ partClone.CFrame = partClone.CFrame:Lerp(realPart.CFrame, lerpAlpha)
690
+ end
691
+ activeLerp = lerpAlpha
692
+ if ended then
693
+ for partClone, realPart in cloneToRealMap do
694
+ partClone:Destroy()
695
+ end
696
+ for thing, originalTransparency in originalTransparencies do
697
+ thing.Transparency = originalTransparency
698
+ end
699
+ return nil
700
+ end
701
+ end
702
+ end)
703
+ activeAnimation:AdjustSpeed(1)
704
+ activeAnimation.Ended:Wait()
705
+ else
706
+ local targetCFrame = CFrame.fromMatrix(centerPoint, forwardOnSurface, groundNormal)
707
+ self.Character:PivotTo(targetCFrame)
708
+ task.wait()
709
+ local activeLerp = 0
710
+ task.spawn(function()
711
+ while true do
712
+ local dt = task.wait(1 / 60)
713
+ local lerpAlpha = activeLerp + (dt / self._standFadeTime)
714
+ local ended = false
715
+ if lerpAlpha >= 1 then
716
+ ended = true
717
+ lerpAlpha = 1
718
+ end
719
+ for partClone, realPart in cloneToRealMap do
720
+ partClone.CFrame = partClone.CFrame:Lerp(realPart.CFrame, lerpAlpha)
721
+ end
722
+ activeLerp = lerpAlpha
723
+ if ended then
724
+ for partClone, realPart in cloneToRealMap do
725
+ partClone:Destroy()
726
+ end
727
+ for thing, originalTransparency in originalTransparencies do
728
+ thing.Transparency = originalTransparency
729
+ end
730
+ return nil
731
+ end
732
+ end
733
+ end)
734
+ task.wait(self._standFadeTime)
735
+ end
736
+ for _, descendant in self.Character:GetDescendants() do
737
+ if descendant:IsA("BasePart") then
738
+ descendant.Anchored = false
739
+ descendant.AssemblyLinearVelocity = Vector3.zero
740
+ descendant.AssemblyAngularVelocity = Vector3.zero
741
+ if descendant:GetAttribute("Falldown_Reverse_CC_To") ~= nil then
742
+ descendant.CanCollide = descendant:GetAttribute("Falldown_Reverse_CC_To")
743
+ descendant:SetAttribute("Falldown_Reverse_CC_To", nil)
744
+ end
745
+ end
746
+ end
747
+ self.Humanoid.PlatformStand = false
748
+ self.HumanoidRootPart.Anchored = false
749
+ RunService.Heartbeat:Wait()
750
+ task.defer(function()
751
+ while self.Humanoid.MoveDirection.Magnitude <= 0 do
752
+ RunService.Stepped:Wait()
753
+ end
754
+ self.HumanoidRootPart:SetNetworkOwner(self.Owner)
755
+ end)
756
+ self.Humanoid.EvaluateStateMachine = true
757
+ self.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
758
+ self.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
759
+ self.Humanoid:ChangeState(Enum.HumanoidStateType.Running)
760
+ self.Ended:Fire()
761
+ self.Ended:Destroy()
762
+ end)
763
+ PhysicsService:UnregisterCollisionGroup(self._proxyGroupId)
764
+ PhysicsService:UnregisterCollisionGroup(self._bodypartGroupId)
765
+ self.Destroyed:Fire()
766
+ self.Destroyed:Destroy()
767
+ end
768
+ end
769
+ --[[
770
+ *
771
+ * Main Falldown class providing static methods for ragdolling characters in Roblox. Creates realistic ragdoll physics by replacing Motor6Ds with constraints, managing collision groups, and providing smooth getup animations.
772
+ * @static
773
+ * @see {@linkcode IActiveRagdoll}
774
+ * @see {@linkcode Falldown.VelocityMode}
775
+
776
+ ]]
777
+ do
778
+ Falldown = setmetatable({}, {
779
+ __tostring = function()
780
+ return "Falldown"
781
+ end,
782
+ })
783
+ Falldown.__index = Falldown
784
+ function Falldown.new(...)
785
+ local self = setmetatable({}, Falldown)
786
+ return self:constructor(...) or self
787
+ end
788
+ function Falldown:constructor()
789
+ end
790
+ function Falldown:MakeProxies(bodyPartMap, proxyGroupId, bodypartGroupId)
791
+ PhysicsService:RegisterCollisionGroup(proxyGroupId)
792
+ PhysicsService:RegisterCollisionGroup(bodypartGroupId)
793
+ PhysicsService:CollisionGroupSetCollidable(proxyGroupId, bodypartGroupId, false)
794
+ PhysicsService:CollisionGroupSetCollidable(proxyGroupId, "Default", true)
795
+ PhysicsService:CollisionGroupSetCollidable(bodypartGroupId, "Default", false)
796
+ PhysicsService:CollisionGroupSetCollidable(bodypartGroupId, bodypartGroupId, false)
797
+ local proxyMap = {}
798
+ for partName, originalPart in bodyPartMap do
799
+ local proxyPart = Instance.new("Part")
800
+ proxyPart.Name = partName .. "_Colprox"
801
+ proxyPart.Size = originalPart.Size
802
+ proxyPart.Transparency = 1
803
+ proxyPart.CastShadow = false
804
+ proxyPart.CanCollide = true
805
+ proxyPart.CanQuery = false
806
+ proxyPart.CanTouch = false
807
+ proxyPart.Anchored = false
808
+ proxyPart.Massless = false
809
+ proxyPart.CFrame = originalPart.CFrame
810
+ proxyPart.CustomPhysicalProperties = PhysicalProperties.new(1, 2, 0, 1, 1)
811
+ if partName == "HumanoidRootPart" then
812
+ proxyPart.CanCollide = false
813
+ end
814
+ local weld = Instance.new("Weld")
815
+ weld.Name = partName .. "_Colprox_Weld"
816
+ weld.Part0 = originalPart
817
+ weld.Part1 = proxyPart
818
+ weld.C0 = CFrame.identity
819
+ weld.Parent = proxyPart
820
+ proxyPart.Parent = Workspace
821
+ proxyPart:SetNetworkOwner(nil)
822
+ proxyPart.CollisionGroup = proxyGroupId
823
+ originalPart.CollisionGroup = bodypartGroupId
824
+ proxyMap[partName] = proxyPart
825
+ end
826
+ return proxyMap
827
+ end
828
+ function Falldown:CreateActiveRagdollR6(character, humanoid, standFadeTime, automaticDuration, getupFront, getupBack)
829
+ local leftArm = character:FindFirstChild("Left Arm")
830
+ local rightArm = character:FindFirstChild("Right Arm")
831
+ local leftLeg = character:FindFirstChild("Left Leg")
832
+ local rightLeg = character:FindFirstChild("Right Leg")
833
+ local torso = character:FindFirstChild("Torso")
834
+ local head = character:FindFirstChild("Head")
835
+ local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
836
+ if (not leftArm or not leftArm:IsA("BasePart")) or (not rightArm or not rightArm:IsA("BasePart")) or (not leftLeg or not leftLeg:IsA("BasePart")) or (not rightLeg or not rightLeg:IsA("BasePart")) or (not torso or not torso:IsA("BasePart")) or (not head or not head:IsA("BasePart")) or (not humanoidRootPart or not humanoidRootPart:IsA("BasePart")) then
837
+ return nil
838
+ end
839
+ local primaryPos = character:GetPivot().Position
840
+ local _cFrame = leftLeg.CFrame
841
+ local _cFrame_1 = CFrame.new(0, -leftLeg.Size.Y / 2, 0)
842
+ local _ = ((_cFrame * _cFrame_1).Position)
843
+ local _cFrame_2 = rightLeg.CFrame
844
+ local _cFrame_3 = CFrame.new(0, -rightLeg.Size.Y / 2, 0)
845
+ local endPos = _:Lerp((_cFrame_2 * _cFrame_3).Position, 0.5)
846
+ local height = (primaryPos - endPos).Magnitude
847
+ humanoid:ChangeState(Enum.HumanoidStateType.Physics)
848
+ local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator", humanoid)
849
+ local getupFrontTrack = if getupFront then animator:LoadAnimation(getupFront) else nil
850
+ local getupBackTrack = if getupBack then animator:LoadAnimation(getupBack) else nil
851
+ local BodyPartMapping = {}
852
+ BodyPartMapping["Left Arm"] = leftArm
853
+ BodyPartMapping["Right Arm"] = rightArm
854
+ BodyPartMapping["Left Leg"] = leftLeg
855
+ BodyPartMapping["Right Leg"] = rightLeg
856
+ BodyPartMapping.Torso = torso
857
+ BodyPartMapping.Head = head
858
+ BodyPartMapping.HumanoidRootPart = humanoidRootPart
859
+ local proxyGroupId = HttpService:GenerateGUID(false)
860
+ local bodypartGroupId = HttpService:GenerateGUID(false)
861
+ for _1, descendant in character:GetDescendants() do
862
+ if descendant:IsA("BasePart") then
863
+ descendant:SetNetworkOwner(nil)
864
+ descendant.CollisionGroup = bodypartGroupId
865
+ end
866
+ end
867
+ local ProxyMapping = self:MakeProxies(BodyPartMapping, proxyGroupId, bodypartGroupId)
868
+ humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
869
+ humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
870
+ humanoid.PlatformStand = true
871
+ humanoid:ChangeState(Enum.HumanoidStateType.PlatformStanding)
872
+ humanoidRootPart:SetAttribute("Falldown_Reverse_CC_To", humanoidRootPart.CanCollide)
873
+ humanoidRootPart.CanCollide = false
874
+ local jointPairs = {}
875
+ local _object = {}
876
+ local _left = "Part0"
877
+ local _takeoverTitle = _r6J.LeftShoulder.Attachment0Info.TakeoverTitle
878
+ local _condition = BodyPartMapping[_takeoverTitle]
879
+ if _condition == nil then
880
+ _condition = humanoidRootPart
881
+ end
882
+ _object[_left] = _condition
883
+ local _left_1 = "Part1"
884
+ local _takeoverTitle_1 = _r6J.LeftShoulder.Attachment1Info.TakeoverTitle
885
+ local _condition_1 = BodyPartMapping[_takeoverTitle_1]
886
+ if _condition_1 == nil then
887
+ _condition_1 = humanoidRootPart
888
+ end
889
+ _object[_left_1] = _condition_1
890
+ _object.Info = _r6J.LeftShoulder
891
+ jointPairs["Left Shoulder"] = _object
892
+ local _object_1 = {}
893
+ local _left_2 = "Part0"
894
+ local _takeoverTitle_2 = _r6J.RightShoulder.Attachment0Info.TakeoverTitle
895
+ local _condition_2 = BodyPartMapping[_takeoverTitle_2]
896
+ if _condition_2 == nil then
897
+ _condition_2 = humanoidRootPart
898
+ end
899
+ _object_1[_left_2] = _condition_2
900
+ local _left_3 = "Part1"
901
+ local _takeoverTitle_3 = _r6J.RightShoulder.Attachment1Info.TakeoverTitle
902
+ local _condition_3 = BodyPartMapping[_takeoverTitle_3]
903
+ if _condition_3 == nil then
904
+ _condition_3 = humanoidRootPart
905
+ end
906
+ _object_1[_left_3] = _condition_3
907
+ _object_1.Info = _r6J.RightShoulder
908
+ jointPairs["Right Shoulder"] = _object_1
909
+ local _object_2 = {}
910
+ local _left_4 = "Part0"
911
+ local _takeoverTitle_4 = _r6J.LeftHip.Attachment0Info.TakeoverTitle
912
+ local _condition_4 = BodyPartMapping[_takeoverTitle_4]
913
+ if _condition_4 == nil then
914
+ _condition_4 = humanoidRootPart
915
+ end
916
+ _object_2[_left_4] = _condition_4
917
+ local _left_5 = "Part1"
918
+ local _takeoverTitle_5 = _r6J.LeftHip.Attachment1Info.TakeoverTitle
919
+ local _condition_5 = BodyPartMapping[_takeoverTitle_5]
920
+ if _condition_5 == nil then
921
+ _condition_5 = humanoidRootPart
922
+ end
923
+ _object_2[_left_5] = _condition_5
924
+ _object_2.Info = _r6J.LeftHip
925
+ jointPairs["Left Hip"] = _object_2
926
+ local _object_3 = {}
927
+ local _left_6 = "Part0"
928
+ local _takeoverTitle_6 = _r6J.RightHip.Attachment0Info.TakeoverTitle
929
+ local _condition_6 = BodyPartMapping[_takeoverTitle_6]
930
+ if _condition_6 == nil then
931
+ _condition_6 = humanoidRootPart
932
+ end
933
+ _object_3[_left_6] = _condition_6
934
+ local _left_7 = "Part1"
935
+ local _takeoverTitle_7 = _r6J.RightHip.Attachment1Info.TakeoverTitle
936
+ local _condition_7 = BodyPartMapping[_takeoverTitle_7]
937
+ if _condition_7 == nil then
938
+ _condition_7 = humanoidRootPart
939
+ end
940
+ _object_3[_left_7] = _condition_7
941
+ _object_3.Info = _r6J.RightHip
942
+ jointPairs["Right Hip"] = _object_3
943
+ local _object_4 = {}
944
+ local _left_8 = "Part0"
945
+ local _takeoverTitle_8 = _r6J.Neck.Attachment0Info.TakeoverTitle
946
+ local _condition_8 = BodyPartMapping[_takeoverTitle_8]
947
+ if _condition_8 == nil then
948
+ _condition_8 = humanoidRootPart
949
+ end
950
+ _object_4[_left_8] = _condition_8
951
+ local _left_9 = "Part1"
952
+ local _takeoverTitle_9 = _r6J.Neck.Attachment1Info.TakeoverTitle
953
+ local _condition_9 = BodyPartMapping[_takeoverTitle_9]
954
+ if _condition_9 == nil then
955
+ _condition_9 = humanoidRootPart
956
+ end
957
+ _object_4[_left_9] = _condition_9
958
+ _object_4.Info = _r6J.Neck
959
+ jointPairs.Neck = _object_4
960
+ local weldPairs = {}
961
+ local _object_5 = {}
962
+ local _left_10 = "Part0"
963
+ local _part0Title = _r6J.Root.Part0Title
964
+ local _condition_10 = BodyPartMapping[_part0Title]
965
+ if _condition_10 == nil then
966
+ _condition_10 = humanoidRootPart
967
+ end
968
+ _object_5[_left_10] = _condition_10
969
+ local _left_11 = "Part1"
970
+ local _part1Title = _r6J.Root.Part1Title
971
+ local _condition_11 = BodyPartMapping[_part1Title]
972
+ if _condition_11 == nil then
973
+ _condition_11 = humanoidRootPart
974
+ end
975
+ _object_5[_left_11] = _condition_11
976
+ _object_5.Info = _r6J.Root
977
+ weldPairs.Root = _object_5
978
+ local destructionInfo = {}
979
+ for constraintName, info in jointPairs do
980
+ local part0 = info.Part0
981
+ local part1 = info.Part1
982
+ local replacing = part0:FindFirstChild(constraintName) or part1:FindFirstChild(constraintName)
983
+ if not replacing or not replacing:IsA("Motor6D") then
984
+ continue
985
+ end
986
+ local at0 = Instance.new("Attachment")
987
+ at0.Name = constraintName .. "_Attachment0"
988
+ at0.Parent = part0
989
+ at0.CFrame = info.Info.Attachment0Info.Offset
990
+ local at1 = Instance.new("Attachment")
991
+ at1.Name = constraintName .. "_Attachment1"
992
+ at1.Parent = part1
993
+ at1.CFrame = info.Info.Attachment1Info.Offset
994
+ local joint = Instance.new("BallSocketConstraint")
995
+ joint.Name = constraintName .. "_Constraint"
996
+ joint.Parent = part0
997
+ joint.Attachment0 = at0
998
+ joint.Attachment1 = at1
999
+ joint.Restitution = info.Info.Restitution
1000
+ joint.MaxFrictionTorque = 50
1001
+ joint.LimitsEnabled = info.Info.LimitsEnabled
1002
+ joint.TwistLimitsEnabled = info.Info.TwistLimitsEnabled
1003
+ joint.UpperAngle = info.Info.UpperAngle
1004
+ joint.TwistUpperAngle = info.Info.TwistUpperAngle
1005
+ joint.TwistLowerAngle = info.Info.TwistLowerAngle
1006
+ local proxyNoCol0 = Instance.new("NoCollisionConstraint")
1007
+ proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
1008
+ local _name = part0.Name
1009
+ proxyNoCol0.Parent = ProxyMapping[_name]
1010
+ local _name_1 = part0.Name
1011
+ proxyNoCol0.Part0 = ProxyMapping[_name_1]
1012
+ local _name_2 = part1.Name
1013
+ proxyNoCol0.Part1 = ProxyMapping[_name_2]
1014
+ replacing.Enabled = false
1015
+ local _arg0 = {
1016
+ Attachment0 = at0,
1017
+ Attachment1 = at1,
1018
+ Constraint = joint,
1019
+ NoCol = nil,
1020
+ Replaced = replacing,
1021
+ }
1022
+ table.insert(destructionInfo, _arg0)
1023
+ end
1024
+ for constraintName, info in weldPairs do
1025
+ local part0 = info.Part0
1026
+ local part1 = info.Part1
1027
+ local replacing = part0:FindFirstChild(constraintName) or part1:FindFirstChild(constraintName)
1028
+ if not replacing or not replacing:IsA("Motor6D") then
1029
+ continue
1030
+ end
1031
+ local weld = Instance.new("WeldConstraint")
1032
+ weld.Name = constraintName .. "_Constraint"
1033
+ weld.Parent = part0
1034
+ weld.Part0 = part0
1035
+ weld.Part1 = part1
1036
+ local proxyNoCol0 = Instance.new("NoCollisionConstraint")
1037
+ proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
1038
+ local _name = part0.Name
1039
+ proxyNoCol0.Parent = ProxyMapping[_name]
1040
+ local _name_1 = part0.Name
1041
+ proxyNoCol0.Part0 = ProxyMapping[_name_1]
1042
+ local _name_2 = part1.Name
1043
+ proxyNoCol0.Part1 = ProxyMapping[_name_2]
1044
+ replacing.Enabled = false
1045
+ local _arg0 = {
1046
+ Attachment0 = nil,
1047
+ Attachment1 = nil,
1048
+ Constraint = weld,
1049
+ NoCol = nil,
1050
+ Replaced = replacing,
1051
+ }
1052
+ table.insert(destructionInfo, _arg0)
1053
+ end
1054
+ for _1, descendant in character:GetDescendants() do
1055
+ local _condition_12 = descendant:IsA("BasePart")
1056
+ if _condition_12 then
1057
+ local _name = descendant.Name
1058
+ _condition_12 = not (BodyPartMapping[_name] ~= nil)
1059
+ end
1060
+ if _condition_12 then
1061
+ descendant:SetAttribute("Falldown_Reverse_CC_To", descendant.CanCollide)
1062
+ descendant.CanCollide = true
1063
+ end
1064
+ end
1065
+ humanoid.EvaluateStateMachine = false
1066
+ return ActiveRagdoll.new(character, height, standFadeTime, humanoid, humanoidRootPart, leftLeg, rightLeg, destructionInfo, proxyGroupId, bodypartGroupId, ProxyMapping, automaticDuration, getupFrontTrack, getupBackTrack)
1067
+ end
1068
+ function Falldown:CreateActiveRagdollR15(character, humanoid, standFadeTime, automaticDuration, getupFront, getupBack)
1069
+ local leftUpperArm = character:FindFirstChild("LeftUpperArm")
1070
+ local leftLowerArm = character:FindFirstChild("LeftLowerArm")
1071
+ local leftHand = character:FindFirstChild("LeftHand")
1072
+ local rightUpperArm = character:FindFirstChild("RightUpperArm")
1073
+ local rightLowerArm = character:FindFirstChild("RightLowerArm")
1074
+ local rightHand = character:FindFirstChild("RightHand")
1075
+ local leftUpperLeg = character:FindFirstChild("LeftUpperLeg")
1076
+ local leftLowerLeg = character:FindFirstChild("LeftLowerLeg")
1077
+ local leftFoot = character:FindFirstChild("LeftFoot")
1078
+ local rightUpperLeg = character:FindFirstChild("RightUpperLeg")
1079
+ local rightLowerLeg = character:FindFirstChild("RightLowerLeg")
1080
+ local rightFoot = character:FindFirstChild("RightFoot")
1081
+ local lowerTorso = character:FindFirstChild("LowerTorso")
1082
+ local upperTorso = character:FindFirstChild("UpperTorso")
1083
+ local head = character:FindFirstChild("Head")
1084
+ local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
1085
+ if (not leftUpperArm or not leftUpperArm:IsA("BasePart")) or (not leftLowerArm or not leftLowerArm:IsA("BasePart")) or (not leftHand or not leftHand:IsA("BasePart")) or (not rightUpperArm or not rightUpperArm:IsA("BasePart")) or (not rightLowerArm or not rightLowerArm:IsA("BasePart")) or (not rightHand or not rightHand:IsA("BasePart")) or (not leftUpperLeg or not leftUpperLeg:IsA("BasePart")) or (not leftLowerLeg or not leftLowerLeg:IsA("BasePart")) or (not leftFoot or not leftFoot:IsA("BasePart")) or (not rightUpperLeg or not rightUpperLeg:IsA("BasePart")) or (not rightLowerLeg or not rightLowerLeg:IsA("BasePart")) or (not rightFoot or not rightFoot:IsA("BasePart")) or (not lowerTorso or not lowerTorso:IsA("BasePart")) or (not upperTorso or not upperTorso:IsA("BasePart")) or (not head or not head:IsA("BasePart")) or (not humanoidRootPart or not humanoidRootPart:IsA("BasePart")) then
1086
+ return nil
1087
+ end
1088
+ local primaryPos = character:GetPivot().Position
1089
+ local _cFrame = leftFoot.CFrame
1090
+ local _cFrame_1 = CFrame.new(0, -leftFoot.Size.Y / 2, 0)
1091
+ local _ = ((_cFrame * _cFrame_1).Position)
1092
+ local _cFrame_2 = rightFoot.CFrame
1093
+ local _cFrame_3 = CFrame.new(0, -rightFoot.Size.Y / 2, 0)
1094
+ local endPos = _:Lerp((_cFrame_2 * _cFrame_3).Position, 0.5)
1095
+ local height = (primaryPos - endPos).Magnitude
1096
+ humanoid:ChangeState(Enum.HumanoidStateType.Physics)
1097
+ local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator", humanoid)
1098
+ local getupFrontTrack = if getupFront then animator:LoadAnimation(getupFront) else nil
1099
+ local getupBackTrack = if getupBack then animator:LoadAnimation(getupBack) else nil
1100
+ local BodyPartMapping = {}
1101
+ BodyPartMapping.LeftUpperArm = leftUpperArm
1102
+ BodyPartMapping.LeftLowerArm = leftLowerArm
1103
+ BodyPartMapping.LeftHand = leftHand
1104
+ BodyPartMapping.RightUpperArm = rightUpperArm
1105
+ BodyPartMapping.RightLowerArm = rightLowerArm
1106
+ BodyPartMapping.RightHand = rightHand
1107
+ BodyPartMapping.LeftUpperLeg = leftUpperLeg
1108
+ BodyPartMapping.LeftLowerLeg = leftLowerLeg
1109
+ BodyPartMapping.LeftFoot = leftFoot
1110
+ BodyPartMapping.RightUpperLeg = rightUpperLeg
1111
+ BodyPartMapping.RightLowerLeg = rightLowerLeg
1112
+ BodyPartMapping.RightFoot = rightFoot
1113
+ BodyPartMapping.LowerTorso = lowerTorso
1114
+ BodyPartMapping.UpperTorso = upperTorso
1115
+ BodyPartMapping.Head = head
1116
+ BodyPartMapping.HumanoidRootPart = humanoidRootPart
1117
+ local proxyGroupId = HttpService:GenerateGUID(false)
1118
+ local bodypartGroupId = HttpService:GenerateGUID(false)
1119
+ for _1, descendant in character:GetDescendants() do
1120
+ if descendant:IsA("BasePart") then
1121
+ descendant:SetNetworkOwner(nil)
1122
+ descendant.CollisionGroup = bodypartGroupId
1123
+ end
1124
+ end
1125
+ local ProxyMapping = self:MakeProxies(BodyPartMapping, proxyGroupId, bodypartGroupId)
1126
+ humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
1127
+ humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
1128
+ humanoid.PlatformStand = true
1129
+ humanoid:ChangeState(Enum.HumanoidStateType.PlatformStanding)
1130
+ humanoidRootPart:SetAttribute("Falldown_Reverse_CC_To", humanoidRootPart.CanCollide)
1131
+ humanoidRootPart.CanCollide = false
1132
+ local socketJointPairs = {}
1133
+ local hingeJointPairs = {}
1134
+ local weldPairs = {}
1135
+ local _object = {}
1136
+ local _left = "Part0"
1137
+ local _takeoverTitle = _r15J.LeftShoulder.Attachment0Info.TakeoverTitle
1138
+ local _condition = BodyPartMapping[_takeoverTitle]
1139
+ if _condition == nil then
1140
+ _condition = humanoidRootPart
1141
+ end
1142
+ _object[_left] = _condition
1143
+ local _left_1 = "Part1"
1144
+ local _takeoverTitle_1 = _r15J.LeftShoulder.Attachment1Info.TakeoverTitle
1145
+ local _condition_1 = BodyPartMapping[_takeoverTitle_1]
1146
+ if _condition_1 == nil then
1147
+ _condition_1 = humanoidRootPart
1148
+ end
1149
+ _object[_left_1] = _condition_1
1150
+ _object.Info = _r15J.LeftShoulder
1151
+ socketJointPairs.LeftShoulder = _object
1152
+ local _object_1 = {}
1153
+ local _left_2 = "Part0"
1154
+ local _takeoverTitle_2 = _r15J.LeftWrist.Attachment0Info.TakeoverTitle
1155
+ local _condition_2 = BodyPartMapping[_takeoverTitle_2]
1156
+ if _condition_2 == nil then
1157
+ _condition_2 = humanoidRootPart
1158
+ end
1159
+ _object_1[_left_2] = _condition_2
1160
+ local _left_3 = "Part1"
1161
+ local _takeoverTitle_3 = _r15J.LeftWrist.Attachment1Info.TakeoverTitle
1162
+ local _condition_3 = BodyPartMapping[_takeoverTitle_3]
1163
+ if _condition_3 == nil then
1164
+ _condition_3 = humanoidRootPart
1165
+ end
1166
+ _object_1[_left_3] = _condition_3
1167
+ _object_1.Info = _r15J.LeftWrist
1168
+ socketJointPairs.LeftWrist = _object_1
1169
+ local _object_2 = {}
1170
+ local _left_4 = "Part0"
1171
+ local _takeoverTitle_4 = _r15J.RightShoulder.Attachment0Info.TakeoverTitle
1172
+ local _condition_4 = BodyPartMapping[_takeoverTitle_4]
1173
+ if _condition_4 == nil then
1174
+ _condition_4 = humanoidRootPart
1175
+ end
1176
+ _object_2[_left_4] = _condition_4
1177
+ local _left_5 = "Part1"
1178
+ local _takeoverTitle_5 = _r15J.RightShoulder.Attachment1Info.TakeoverTitle
1179
+ local _condition_5 = BodyPartMapping[_takeoverTitle_5]
1180
+ if _condition_5 == nil then
1181
+ _condition_5 = humanoidRootPart
1182
+ end
1183
+ _object_2[_left_5] = _condition_5
1184
+ _object_2.Info = _r15J.RightShoulder
1185
+ socketJointPairs.RightShoulder = _object_2
1186
+ local _object_3 = {}
1187
+ local _left_6 = "Part0"
1188
+ local _takeoverTitle_6 = _r15J.RightWrist.Attachment0Info.TakeoverTitle
1189
+ local _condition_6 = BodyPartMapping[_takeoverTitle_6]
1190
+ if _condition_6 == nil then
1191
+ _condition_6 = humanoidRootPart
1192
+ end
1193
+ _object_3[_left_6] = _condition_6
1194
+ local _left_7 = "Part1"
1195
+ local _takeoverTitle_7 = _r15J.RightWrist.Attachment1Info.TakeoverTitle
1196
+ local _condition_7 = BodyPartMapping[_takeoverTitle_7]
1197
+ if _condition_7 == nil then
1198
+ _condition_7 = humanoidRootPart
1199
+ end
1200
+ _object_3[_left_7] = _condition_7
1201
+ _object_3.Info = _r15J.RightWrist
1202
+ socketJointPairs.RightWrist = _object_3
1203
+ local _object_4 = {}
1204
+ local _left_8 = "Part0"
1205
+ local _takeoverTitle_8 = _r15J.LeftHip.Attachment0Info.TakeoverTitle
1206
+ local _condition_8 = BodyPartMapping[_takeoverTitle_8]
1207
+ if _condition_8 == nil then
1208
+ _condition_8 = humanoidRootPart
1209
+ end
1210
+ _object_4[_left_8] = _condition_8
1211
+ local _left_9 = "Part1"
1212
+ local _takeoverTitle_9 = _r15J.LeftHip.Attachment1Info.TakeoverTitle
1213
+ local _condition_9 = BodyPartMapping[_takeoverTitle_9]
1214
+ if _condition_9 == nil then
1215
+ _condition_9 = humanoidRootPart
1216
+ end
1217
+ _object_4[_left_9] = _condition_9
1218
+ _object_4.Info = _r15J.LeftHip
1219
+ socketJointPairs.LeftHip = _object_4
1220
+ local _object_5 = {}
1221
+ local _left_10 = "Part0"
1222
+ local _takeoverTitle_10 = _r15J.LeftAnkle.Attachment0Info.TakeoverTitle
1223
+ local _condition_10 = BodyPartMapping[_takeoverTitle_10]
1224
+ if _condition_10 == nil then
1225
+ _condition_10 = humanoidRootPart
1226
+ end
1227
+ _object_5[_left_10] = _condition_10
1228
+ local _left_11 = "Part1"
1229
+ local _takeoverTitle_11 = _r15J.LeftAnkle.Attachment1Info.TakeoverTitle
1230
+ local _condition_11 = BodyPartMapping[_takeoverTitle_11]
1231
+ if _condition_11 == nil then
1232
+ _condition_11 = humanoidRootPart
1233
+ end
1234
+ _object_5[_left_11] = _condition_11
1235
+ _object_5.Info = _r15J.LeftAnkle
1236
+ socketJointPairs.LeftAnkle = _object_5
1237
+ local _object_6 = {}
1238
+ local _left_12 = "Part0"
1239
+ local _takeoverTitle_12 = _r15J.RightHip.Attachment0Info.TakeoverTitle
1240
+ local _condition_12 = BodyPartMapping[_takeoverTitle_12]
1241
+ if _condition_12 == nil then
1242
+ _condition_12 = humanoidRootPart
1243
+ end
1244
+ _object_6[_left_12] = _condition_12
1245
+ local _left_13 = "Part1"
1246
+ local _takeoverTitle_13 = _r15J.RightHip.Attachment1Info.TakeoverTitle
1247
+ local _condition_13 = BodyPartMapping[_takeoverTitle_13]
1248
+ if _condition_13 == nil then
1249
+ _condition_13 = humanoidRootPart
1250
+ end
1251
+ _object_6[_left_13] = _condition_13
1252
+ _object_6.Info = _r15J.RightHip
1253
+ socketJointPairs.RightHip = _object_6
1254
+ local _object_7 = {}
1255
+ local _left_14 = "Part0"
1256
+ local _takeoverTitle_14 = _r15J.RightAnkle.Attachment0Info.TakeoverTitle
1257
+ local _condition_14 = BodyPartMapping[_takeoverTitle_14]
1258
+ if _condition_14 == nil then
1259
+ _condition_14 = humanoidRootPart
1260
+ end
1261
+ _object_7[_left_14] = _condition_14
1262
+ local _left_15 = "Part1"
1263
+ local _takeoverTitle_15 = _r15J.RightAnkle.Attachment1Info.TakeoverTitle
1264
+ local _condition_15 = BodyPartMapping[_takeoverTitle_15]
1265
+ if _condition_15 == nil then
1266
+ _condition_15 = humanoidRootPart
1267
+ end
1268
+ _object_7[_left_15] = _condition_15
1269
+ _object_7.Info = _r15J.RightAnkle
1270
+ socketJointPairs.RightAnkle = _object_7
1271
+ local _object_8 = {}
1272
+ local _left_16 = "Part0"
1273
+ local _takeoverTitle_16 = _r15J.Neck.Attachment0Info.TakeoverTitle
1274
+ local _condition_16 = BodyPartMapping[_takeoverTitle_16]
1275
+ if _condition_16 == nil then
1276
+ _condition_16 = humanoidRootPart
1277
+ end
1278
+ _object_8[_left_16] = _condition_16
1279
+ local _left_17 = "Part1"
1280
+ local _takeoverTitle_17 = _r15J.Neck.Attachment1Info.TakeoverTitle
1281
+ local _condition_17 = BodyPartMapping[_takeoverTitle_17]
1282
+ if _condition_17 == nil then
1283
+ _condition_17 = humanoidRootPart
1284
+ end
1285
+ _object_8[_left_17] = _condition_17
1286
+ _object_8.Info = _r15J.Neck
1287
+ socketJointPairs.Neck = _object_8
1288
+ local _object_9 = {}
1289
+ local _left_18 = "Part0"
1290
+ local _takeoverTitle_18 = _r15J.LeftElbow.Attachment0Info.TakeoverTitle
1291
+ local _condition_18 = BodyPartMapping[_takeoverTitle_18]
1292
+ if _condition_18 == nil then
1293
+ _condition_18 = humanoidRootPart
1294
+ end
1295
+ _object_9[_left_18] = _condition_18
1296
+ local _left_19 = "Part1"
1297
+ local _takeoverTitle_19 = _r15J.LeftElbow.Attachment1Info.TakeoverTitle
1298
+ local _condition_19 = BodyPartMapping[_takeoverTitle_19]
1299
+ if _condition_19 == nil then
1300
+ _condition_19 = humanoidRootPart
1301
+ end
1302
+ _object_9[_left_19] = _condition_19
1303
+ _object_9.Info = _r15J.LeftElbow
1304
+ hingeJointPairs.LeftElbow = _object_9
1305
+ local _object_10 = {}
1306
+ local _left_20 = "Part0"
1307
+ local _takeoverTitle_20 = _r15J.RightElbow.Attachment0Info.TakeoverTitle
1308
+ local _condition_20 = BodyPartMapping[_takeoverTitle_20]
1309
+ if _condition_20 == nil then
1310
+ _condition_20 = humanoidRootPart
1311
+ end
1312
+ _object_10[_left_20] = _condition_20
1313
+ local _left_21 = "Part1"
1314
+ local _takeoverTitle_21 = _r15J.RightElbow.Attachment1Info.TakeoverTitle
1315
+ local _condition_21 = BodyPartMapping[_takeoverTitle_21]
1316
+ if _condition_21 == nil then
1317
+ _condition_21 = humanoidRootPart
1318
+ end
1319
+ _object_10[_left_21] = _condition_21
1320
+ _object_10.Info = _r15J.RightElbow
1321
+ hingeJointPairs.RightElbow = _object_10
1322
+ local _object_11 = {}
1323
+ local _left_22 = "Part0"
1324
+ local _takeoverTitle_22 = _r15J.LeftKnee.Attachment0Info.TakeoverTitle
1325
+ local _condition_22 = BodyPartMapping[_takeoverTitle_22]
1326
+ if _condition_22 == nil then
1327
+ _condition_22 = humanoidRootPart
1328
+ end
1329
+ _object_11[_left_22] = _condition_22
1330
+ local _left_23 = "Part1"
1331
+ local _takeoverTitle_23 = _r15J.LeftKnee.Attachment1Info.TakeoverTitle
1332
+ local _condition_23 = BodyPartMapping[_takeoverTitle_23]
1333
+ if _condition_23 == nil then
1334
+ _condition_23 = humanoidRootPart
1335
+ end
1336
+ _object_11[_left_23] = _condition_23
1337
+ _object_11.Info = _r15J.LeftKnee
1338
+ hingeJointPairs.LeftKnee = _object_11
1339
+ local _object_12 = {}
1340
+ local _left_24 = "Part0"
1341
+ local _takeoverTitle_24 = _r15J.RightKnee.Attachment0Info.TakeoverTitle
1342
+ local _condition_24 = BodyPartMapping[_takeoverTitle_24]
1343
+ if _condition_24 == nil then
1344
+ _condition_24 = humanoidRootPart
1345
+ end
1346
+ _object_12[_left_24] = _condition_24
1347
+ local _left_25 = "Part1"
1348
+ local _takeoverTitle_25 = _r15J.RightKnee.Attachment1Info.TakeoverTitle
1349
+ local _condition_25 = BodyPartMapping[_takeoverTitle_25]
1350
+ if _condition_25 == nil then
1351
+ _condition_25 = humanoidRootPart
1352
+ end
1353
+ _object_12[_left_25] = _condition_25
1354
+ _object_12.Info = _r15J.RightKnee
1355
+ hingeJointPairs.RightKnee = _object_12
1356
+ local _object_13 = {}
1357
+ local _left_26 = "Part0"
1358
+ local _takeoverTitle_26 = _r15J.Waist.Attachment0Info.TakeoverTitle
1359
+ local _condition_26 = BodyPartMapping[_takeoverTitle_26]
1360
+ if _condition_26 == nil then
1361
+ _condition_26 = humanoidRootPart
1362
+ end
1363
+ _object_13[_left_26] = _condition_26
1364
+ local _left_27 = "Part1"
1365
+ local _takeoverTitle_27 = _r15J.Waist.Attachment1Info.TakeoverTitle
1366
+ local _condition_27 = BodyPartMapping[_takeoverTitle_27]
1367
+ if _condition_27 == nil then
1368
+ _condition_27 = humanoidRootPart
1369
+ end
1370
+ _object_13[_left_27] = _condition_27
1371
+ _object_13.Info = _r15J.Waist
1372
+ hingeJointPairs.Waist = _object_13
1373
+ local _object_14 = {}
1374
+ local _left_28 = "Part0"
1375
+ local _part0Title = _r15J.Root.Part0Title
1376
+ local _condition_28 = BodyPartMapping[_part0Title]
1377
+ if _condition_28 == nil then
1378
+ _condition_28 = humanoidRootPart
1379
+ end
1380
+ _object_14[_left_28] = _condition_28
1381
+ local _left_29 = "Part1"
1382
+ local _part1Title = _r15J.Root.Part1Title
1383
+ local _condition_29 = BodyPartMapping[_part1Title]
1384
+ if _condition_29 == nil then
1385
+ _condition_29 = humanoidRootPart
1386
+ end
1387
+ _object_14[_left_29] = _condition_29
1388
+ _object_14.Info = _r15J.Root
1389
+ weldPairs.Root = _object_14
1390
+ local destructionInfo = {}
1391
+ for constraintName, info in socketJointPairs do
1392
+ local part0 = info.Part0
1393
+ local part1 = info.Part1
1394
+ local replacing = part0:FindFirstChild(constraintName) or part1:FindFirstChild(constraintName)
1395
+ if not replacing or not replacing:IsA("Motor6D") then
1396
+ continue
1397
+ end
1398
+ local at0 = Instance.new("Attachment")
1399
+ at0.Name = constraintName .. "_Attachment0"
1400
+ at0.Parent = part0
1401
+ at0.CFrame = info.Info.Attachment0Info.Offset
1402
+ local at1 = Instance.new("Attachment")
1403
+ at1.Name = constraintName .. "_Attachment1"
1404
+ at1.Parent = part1
1405
+ at1.CFrame = info.Info.Attachment1Info.Offset
1406
+ local joint = Instance.new("BallSocketConstraint")
1407
+ joint.Name = constraintName .. "_Constraint"
1408
+ joint.Parent = part0
1409
+ joint.Attachment0 = at0
1410
+ joint.Attachment1 = at1
1411
+ joint.Restitution = info.Info.Restitution
1412
+ joint.MaxFrictionTorque = 50
1413
+ joint.LimitsEnabled = info.Info.LimitsEnabled
1414
+ joint.TwistLimitsEnabled = info.Info.TwistLimitsEnabled
1415
+ joint.UpperAngle = info.Info.UpperAngle
1416
+ joint.TwistUpperAngle = info.Info.TwistUpperAngle
1417
+ joint.TwistLowerAngle = info.Info.TwistLowerAngle
1418
+ local proxyNoCol0 = Instance.new("NoCollisionConstraint")
1419
+ proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
1420
+ local _name = part0.Name
1421
+ proxyNoCol0.Parent = ProxyMapping[_name]
1422
+ local _name_1 = part0.Name
1423
+ proxyNoCol0.Part0 = ProxyMapping[_name_1]
1424
+ local _name_2 = part1.Name
1425
+ proxyNoCol0.Part1 = ProxyMapping[_name_2]
1426
+ replacing.Enabled = false
1427
+ local _arg0 = {
1428
+ Attachment0 = at0,
1429
+ Attachment1 = at1,
1430
+ Constraint = joint,
1431
+ NoCol = nil,
1432
+ Replaced = replacing,
1433
+ }
1434
+ table.insert(destructionInfo, _arg0)
1435
+ end
1436
+ for constraintName, info in hingeJointPairs do
1437
+ local part0 = info.Part0
1438
+ local part1 = info.Part1
1439
+ local replacing = part0:FindFirstChild(constraintName) or part1:FindFirstChild(constraintName)
1440
+ if not replacing or not replacing:IsA("Motor6D") then
1441
+ continue
1442
+ end
1443
+ local at0 = Instance.new("Attachment")
1444
+ at0.Name = constraintName .. "_Attachment0"
1445
+ at0.Parent = part0
1446
+ at0.CFrame = info.Info.Attachment0Info.Offset
1447
+ local at1 = Instance.new("Attachment")
1448
+ at1.Name = constraintName .. "_Attachment1"
1449
+ at1.Parent = part1
1450
+ at1.CFrame = info.Info.Attachment1Info.Offset
1451
+ local joint = Instance.new("HingeConstraint")
1452
+ joint.Name = constraintName .. "_Constraint"
1453
+ joint.Parent = part0
1454
+ joint.Attachment0 = at0
1455
+ joint.Attachment1 = at1
1456
+ joint.Restitution = info.Info.Restitution
1457
+ joint.LimitsEnabled = info.Info.LimitsEnabled
1458
+ joint.UpperAngle = info.Info.UpperAngle
1459
+ joint.LowerAngle = info.Info.LowerAngle
1460
+ local proxyNoCol0 = Instance.new("NoCollisionConstraint")
1461
+ proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
1462
+ local _name = part0.Name
1463
+ proxyNoCol0.Parent = ProxyMapping[_name]
1464
+ local _name_1 = part0.Name
1465
+ proxyNoCol0.Part0 = ProxyMapping[_name_1]
1466
+ local _name_2 = part1.Name
1467
+ proxyNoCol0.Part1 = ProxyMapping[_name_2]
1468
+ replacing.Enabled = false
1469
+ local _arg0 = {
1470
+ Attachment0 = at0,
1471
+ Attachment1 = at1,
1472
+ Constraint = joint,
1473
+ NoCol = nil,
1474
+ Replaced = replacing,
1475
+ }
1476
+ table.insert(destructionInfo, _arg0)
1477
+ end
1478
+ for constraintName, info in weldPairs do
1479
+ local part0 = info.Part0
1480
+ local part1 = info.Part1
1481
+ local replacing = part0:FindFirstChild(constraintName) or part1:FindFirstChild(constraintName)
1482
+ if not replacing or not replacing:IsA("Motor6D") then
1483
+ continue
1484
+ end
1485
+ local weld = Instance.new("WeldConstraint")
1486
+ weld.Name = constraintName .. "_Constraint"
1487
+ weld.Parent = part0
1488
+ weld.Part0 = part0
1489
+ weld.Part1 = part1
1490
+ local proxyNoCol0 = Instance.new("NoCollisionConstraint")
1491
+ proxyNoCol0.Name = constraintName .. "_NoColProxyOnly"
1492
+ local _name = part0.Name
1493
+ proxyNoCol0.Parent = ProxyMapping[_name]
1494
+ local _name_1 = part0.Name
1495
+ proxyNoCol0.Part0 = ProxyMapping[_name_1]
1496
+ local _name_2 = part1.Name
1497
+ proxyNoCol0.Part1 = ProxyMapping[_name_2]
1498
+ replacing.Enabled = false
1499
+ local _arg0 = {
1500
+ Attachment0 = nil,
1501
+ Attachment1 = nil,
1502
+ Constraint = weld,
1503
+ NoCol = nil,
1504
+ Replaced = replacing,
1505
+ }
1506
+ table.insert(destructionInfo, _arg0)
1507
+ end
1508
+ for _1, descendant in character:GetDescendants() do
1509
+ local _condition_30 = descendant:IsA("BasePart")
1510
+ if _condition_30 then
1511
+ local _name = descendant.Name
1512
+ _condition_30 = not (BodyPartMapping[_name] ~= nil)
1513
+ end
1514
+ if _condition_30 then
1515
+ descendant:SetAttribute("Falldown_Reverse_CC_To", descendant.CanCollide)
1516
+ descendant.CanCollide = true
1517
+ end
1518
+ end
1519
+ humanoid.EvaluateStateMachine = false
1520
+ return ActiveRagdoll.new(character, height, standFadeTime, humanoid, humanoidRootPart, leftFoot, rightFoot, destructionInfo, proxyGroupId, bodypartGroupId, ProxyMapping, automaticDuration, getupFrontTrack, getupBackTrack)
1521
+ end
1522
+ function Falldown:RagdollCharacter(character, standupFadeTime, automaticDuration, getupFront, getupBack)
1523
+ local __activeRagdolls = self._activeRagdolls
1524
+ local _character = character
1525
+ if __activeRagdolls[_character] ~= nil then
1526
+ return nil
1527
+ end
1528
+ local humanoid = character:FindFirstChildOfClass("Humanoid")
1529
+ if not humanoid then
1530
+ return nil
1531
+ end
1532
+ if humanoid.RigType == Enum.HumanoidRigType.R6 then
1533
+ local createdActiveRagdoll = self:CreateActiveRagdollR6(character, humanoid, standupFadeTime, automaticDuration, getupFront, getupBack)
1534
+ if createdActiveRagdoll then
1535
+ local __activeRagdolls_1 = self._activeRagdolls
1536
+ local _character_1 = character
1537
+ __activeRagdolls_1[_character_1] = createdActiveRagdoll
1538
+ createdActiveRagdoll.Destroyed:Once(function()
1539
+ local __activeRagdolls_2 = self._activeRagdolls
1540
+ local _character_2 = character
1541
+ if __activeRagdolls_2[_character_2] ~= nil then
1542
+ local __activeRagdolls_3 = self._activeRagdolls
1543
+ local _character_3 = character
1544
+ __activeRagdolls_3[_character_3] = nil
1545
+ end
1546
+ end)
1547
+ return createdActiveRagdoll
1548
+ else
1549
+ return nil
1550
+ end
1551
+ else
1552
+ local createdActiveRagdoll = self:CreateActiveRagdollR15(character, humanoid, standupFadeTime, automaticDuration, getupFront, getupBack)
1553
+ if createdActiveRagdoll then
1554
+ local __activeRagdolls_1 = self._activeRagdolls
1555
+ local _character_1 = character
1556
+ __activeRagdolls_1[_character_1] = createdActiveRagdoll
1557
+ createdActiveRagdoll.Destroyed:Once(function()
1558
+ local __activeRagdolls_2 = self._activeRagdolls
1559
+ local _character_2 = character
1560
+ if __activeRagdolls_2[_character_2] ~= nil then
1561
+ local __activeRagdolls_3 = self._activeRagdolls
1562
+ local _character_3 = character
1563
+ __activeRagdolls_3[_character_3] = nil
1564
+ end
1565
+ end)
1566
+ return createdActiveRagdoll
1567
+ else
1568
+ return nil
1569
+ end
1570
+ end
1571
+ end
1572
+ function Falldown:UnragdollCharacter(character, delayTime)
1573
+ local __activeRagdolls = self._activeRagdolls
1574
+ local _character = character
1575
+ local activeRagdoll = __activeRagdolls[_character]
1576
+ if activeRagdoll then
1577
+ if delayTime ~= 0 and delayTime == delayTime and delayTime then
1578
+ delay(delayTime, function()
1579
+ local __activeRagdolls_1 = self._activeRagdolls
1580
+ local _character_1 = character
1581
+ if __activeRagdolls_1[_character_1] ~= nil then
1582
+ local __activeRagdolls_2 = self._activeRagdolls
1583
+ local _character_2 = character
1584
+ __activeRagdolls_2[_character_2] = nil
1585
+ activeRagdoll:Destroy()
1586
+ end
1587
+ end)
1588
+ else
1589
+ local __activeRagdolls_1 = self._activeRagdolls
1590
+ local _character_1 = character
1591
+ if __activeRagdolls_1[_character_1] ~= nil then
1592
+ local __activeRagdolls_2 = self._activeRagdolls
1593
+ local _character_2 = character
1594
+ __activeRagdolls_2[_character_2] = nil
1595
+ activeRagdoll:Destroy()
1596
+ end
1597
+ end
1598
+ end
1599
+ end
1600
+ function Falldown:UnragdollAllCharacters(delayTime)
1601
+ if delayTime ~= 0 and delayTime == delayTime and delayTime then
1602
+ delay(delayTime, function()
1603
+ for character, activeRagdoll in self._activeRagdolls do
1604
+ if self._activeRagdolls[character] ~= nil then
1605
+ self._activeRagdolls[character] = nil
1606
+ activeRagdoll:Destroy()
1607
+ end
1608
+ end
1609
+ end)
1610
+ else
1611
+ for character, activeRagdoll in self._activeRagdolls do
1612
+ if self._activeRagdolls[character] ~= nil then
1613
+ self._activeRagdolls[character] = nil
1614
+ activeRagdoll:Destroy()
1615
+ end
1616
+ end
1617
+ end
1618
+ end
1619
+ Falldown.VelocityMode = {
1620
+ RootOnly = 0,
1621
+ AllEqual = 1,
1622
+ SplitEqual = 2,
1623
+ RandomMax = 3,
1624
+ }
1625
+ Falldown._activeRagdolls = {}
1626
+ end
1627
+ return {
1628
+ Falldown = Falldown,
1629
+ }