SHOW:
|
|
- or go back to the newest paste.
1 | function limb_collide(obj,mode) | |
2 | if (obj:IsA("UnionOperation") or obj:IsA("BasePart")) and not obj:FindFirstChild('limb') then else return end | |
3 | local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide') | |
4 | if not exists then | |
5 | game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide') | |
6 | end | |
7 | game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false) | |
8 | -- | |
9 | local t = {} | |
10 | -- | |
11 | local cb = Instance.new("Part") | |
12 | cb.Name = 'limb' | |
13 | cb.Transparency = 1 | |
14 | cb.CanCollide = true | |
15 | cb.Anchored = false | |
16 | cb.CFrame = obj.CFrame | |
17 | cb.Size = obj.Size | |
18 | cb.Massless = true | |
19 | cb.Locked = true | |
20 | game:GetService("PhysicsService"):SetPartCollisionGroup(cb,'Limb Collide') | |
21 | game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide') | |
22 | local weld = Instance.new("Weld") | |
23 | weld.Part0 = cb | |
24 | weld.Part1 = obj | |
25 | weld.Parent = cb | |
26 | obj.Massless = true | |
27 | obj.Anchored = false | |
28 | if mode or obj:FindFirstChild("Dismembered") then | |
29 | cb.Parent = obj -- .Parent | |
30 | else | |
31 | cb.Parent = script | |
32 | table.insert(t,1,cb) | |
33 | end | |
34 | -- | |
35 | if not string.match(obj.Name:lower(),'torso') and not string.match(obj.Name:lower(),'rootpart') and not string.match(obj.Name:lower(),'head') then | |
36 | local lv = Vector3.new() -- Vector3.new(cb.Size.X,0,cb.Size.Z) | |
37 | local cb2 = Instance.new("Part") | |
38 | - | LA.Scale = Vector3.new(1,0.5,1) |
38 | + | cb2.Name = 'limb' |
39 | - | RA.Scale = Vector3.new(1,0.5,1) |
39 | + | cb2.Transparency = 1 |
40 | cb2.CanCollide = true | |
41 | cb2.Anchored = false | |
42 | cb2.CFrame = obj.CFrame | |
43 | cb2.Size = lv | |
44 | cb2.Massless = true | |
45 | cb2.Locked = true | |
46 | local weld2 = Instance.new("Weld") | |
47 | weld2.Part0 = cb | |
48 | weld2.Part1 = cb2 | |
49 | weld2.C1 = CFrame.new(0,(cb.Size.Y/2),0) | |
50 | weld2.Parent = cb2 | |
51 | if mode or obj:FindFirstChild("Dismembered") then | |
52 | cb2.Parent = obj -- .Parent | |
53 | else | |
54 | cb2.Parent = script | |
55 | table.insert(t,1,cb2) | |
56 | end | |
57 | end | |
58 | -- | |
59 | return t | |
60 | end | |
61 | function Ragdoll(targchar,headless,insta,kill) | |
62 | local pc = targchar | |
63 | local targhum = pc:FindFirstChild("Humanoid") | |
64 | local js,js2 = {},{} | |
65 | for _,obj in pairs(pc:GetDescendants()) do | |
66 | if obj:IsA("BasePart") or obj:IsA("UnionOperation") then | |
67 | obj.Massless = true | |
68 | obj.Locked = true | |
69 | end | |
70 | end | |
71 | if kill == true then | |
72 | pc.Archivable = true | |
73 | local old_pc = pc | |
74 | pc = pc:Clone() | |
75 | for i,v in pairs(pc:GetDescendants()) do | |
76 | limb_collide(v,true) | |
77 | if v:IsA("ParticleEmitter") then | |
78 | v.Enabled = false | |
79 | end | |
80 | if v:IsA("SelectionBox") or v:IsA("BodyVelocity") or v:IsA("BodyPosition") or v:IsA("BodyAngularVelocity") or v:IsA("BodyForce") or v:IsA("BodyGyro") or v:IsA("BodyThrust") or v:IsA("BodyMover") then | |
81 | if v:IsA("BodyVelocity") then | |
82 | game:GetService("Debris"):AddItem(v,0.15) | |
83 | else | |
84 | v:Destroy() | |
85 | end | |
86 | end | |
87 | if (v:IsA("Script") and v.Name == 'Health') or (v:IsA("LocalScript") and v.Name == 'Animate') then | |
88 | v:Destroy() | |
89 | end | |
90 | if v:IsA("Humanoid") then | |
91 | v.BreakJointsOnDeath = false | |
92 | v.Health = 0 | |
93 | v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff | |
94 | v.PlatformStand = true | |
95 | end | |
96 | end | |
97 | for i,v in pairs(old_pc:GetDescendants()) do | |
98 | if v:IsA("BasePart") or v:IsA("UnionOperation") or v:IsA("ForceField") or v:IsA("Accessory") or v:IsA("Decal") or v:IsA("Texture") or v:IsA("SurfaceGui") then | |
99 | v:destroy() | |
100 | end | |
101 | if v:IsA("Humanoid") then | |
102 | v.BreakJointsOnDeath = true | |
103 | v.Health = 0 | |
104 | v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff | |
105 | v.PlatformStand = true | |
106 | end | |
107 | end | |
108 | pc.Parent = workspace | |
109 | game:GetService("Debris"):AddItem(pc,30) | |
110 | end | |
111 | --if kill and targhum:FindFirstChild("Ragdolled") then return; end; | |
112 | if pc ~= nil then | |
113 | local hum = pc:FindFirstChild'Humanoid' | |
114 | local LArm = pc:FindFirstChild'Left Arm' | |
115 | local RArm = pc:FindFirstChild'Right Arm' | |
116 | local LLeg = pc:FindFirstChild'Left Leg' | |
117 | local RLeg = pc:FindFirstChild'Right Leg' | |
118 | local torso = pc:FindFirstChild'Torso' | |
119 | local head = pc:FindFirstChild'Head' | |
120 | ||
121 | ||
122 | local LUA = pc:FindFirstChild'LeftUpperArm' | |
123 | local LLA = pc:FindFirstChild'LeftLowerArm' | |
124 | local LH = pc:FindFirstChild'LeftHand' | |
125 | ||
126 | local RUA = pc:FindFirstChild'RightUpperArm' | |
127 | local RLA = pc:FindFirstChild'RightLowerArm' | |
128 | local RH = pc:FindFirstChild'RightHand' | |
129 | ||
130 | local LUL = pc:FindFirstChild'LeftUpperLeg' | |
131 | local LLL = pc:FindFirstChild'LeftLowerLeg' | |
132 | local LF = pc:FindFirstChild'LeftFoot' | |
133 | ||
134 | local RUL = pc:FindFirstChild'RightUpperLeg' | |
135 | local RLL = pc:FindFirstChild'RightLowerLeg' | |
136 | local RF = pc:FindFirstChild'RightFoot' | |
137 | ||
138 | local UT = pc:FindFirstChild'UpperTorso' | |
139 | local LT = pc:FindFirstChild'LowerTorso' | |
140 | ||
141 | if hum and LArm and RArm and LLeg and RLeg and head then | |
142 | hum.BreakJointsOnDeath = false | |
143 | if insta then | |
144 | if hum.RigType==Enum.HumanoidRigType.R6 then | |
145 | for _,v in pairs(torso:GetDescendants()) do | |
146 | if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA('Weld') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then | |
147 | if not kill then | |
148 | table.insert(js2,1,{obj = v,par = v.Parent}) | |
149 | v.Parent = nil | |
150 | elseif kill then | |
151 | v:Destroy() | |
152 | end | |
153 | end | |
154 | end | |
155 | local vis = false | |
156 | local vis2 = false | |
157 | if LArm and not LArm:FindFirstChild('Dismembered') then | |
158 | local at1 = Instance.new("Attachment") | |
159 | at1.Parent = torso | |
160 | at1.Visible = vis | |
161 | at1.Orientation = torso.Orientation + Vector3.new(0,180,0) | |
162 | at1.Position = Vector3.new(-1,1,0) | |
163 | ||
164 | local at1p2 = Instance.new("Attachment") | |
165 | at1p2.Parent = LArm | |
166 | at1p2.Visible = vis | |
167 | at1p2.Orientation = LArm.Orientation + Vector3.new(0,180,0) | |
168 | at1p2.Position = Vector3.new(.5,1,0) | |
169 | ||
170 | local bis = Instance.new("BallSocketConstraint") | |
171 | bis.Parent = LArm | |
172 | bis.Attachment0 = at1 | |
173 | bis.Attachment1 = at1p2 | |
174 | bis.LimitsEnabled = true | |
175 | bis.UpperAngle = 15 | |
176 | bis.Visible = vis2 | |
177 | bis.TwistLimitsEnabled = true | |
178 | bis.UpperAngle = -45 | |
179 | bis.TwistLowerAngle = -45 | |
180 | table.insert(js,1,bis) | |
181 | end | |
182 | if RArm and not RArm:FindFirstChild('Dismembered') then | |
183 | local at2 = Instance.new("Attachment") | |
184 | at2.Parent = torso | |
185 | at2.Visible = vis | |
186 | at2.Orientation = torso.Orientation + Vector3.new(0,0,0) | |
187 | at2.Position = Vector3.new(1,1,0) | |
188 | ||
189 | local at2p2 = Instance.new("Attachment") | |
190 | at2p2.Parent = RArm | |
191 | at2p2.Visible = vis | |
192 | at2p2.Orientation = RArm.Orientation + Vector3.new(0,0,0) | |
193 | at2p2.Position = Vector3.new(-.5,1,0) | |
194 | ||
195 | local bis2 = Instance.new("BallSocketConstraint") | |
196 | bis2.Parent = RArm | |
197 | bis2.Attachment0 = at2 | |
198 | bis2.Attachment1 = at2p2 | |
199 | bis2.LimitsEnabled = true | |
200 | bis2.UpperAngle = 15 | |
201 | bis2.Visible = vis2 | |
202 | bis2.TwistLimitsEnabled = true | |
203 | bis2.UpperAngle = -45 | |
204 | bis2.TwistLowerAngle = -45 | |
205 | table.insert(js,1,bis2) | |
206 | end | |
207 | if RLeg and not RLeg:FindFirstChild('Dismembered') then | |
208 | local at3 = Instance.new("Attachment") | |
209 | at3.Parent = torso | |
210 | at3.Visible = vis | |
211 | at3.Orientation = torso.Orientation + Vector3.new(90,0,-90) | |
212 | at3.Position = Vector3.new(.5,-1,0) | |
213 | ||
214 | local at3p2 = Instance.new("Attachment") | |
215 | at3p2.Parent = RLeg | |
216 | at3p2.Visible = vis | |
217 | at3p2.Orientation = RLeg.Orientation + Vector3.new(90,0,-90) | |
218 | at3p2.Position = Vector3.new(0,1,0) | |
219 | ||
220 | local bis3 = Instance.new("BallSocketConstraint") | |
221 | bis3.Parent = RLeg | |
222 | bis3.Attachment0 = at3 | |
223 | bis3.Attachment1 = at3p2 | |
224 | bis3.LimitsEnabled = true | |
225 | bis3.UpperAngle = 180-15 | |
226 | bis3.Visible = vis2 | |
227 | table.insert(js,1,bis3) | |
228 | end | |
229 | ||
230 | if LLeg and not LLeg:FindFirstChild('Dismembered') then | |
231 | local at4 = Instance.new("Attachment") | |
232 | at4.Parent = torso | |
233 | at4.Visible = vis | |
234 | at4.Orientation = torso.Orientation + Vector3.new(90,0,-90) | |
235 | at4.Position = Vector3.new(-.5,-1,0) | |
236 | ||
237 | local at4p2 = Instance.new("Attachment") | |
238 | at4p2.Parent = LLeg | |
239 | at4p2.Visible = vis | |
240 | at4p2.Orientation = LLeg.Orientation + Vector3.new(90,0,-90) | |
241 | at4p2.Position = Vector3.new(0,1,0) | |
242 | ||
243 | local bis4 = Instance.new("BallSocketConstraint") | |
244 | bis4.Parent = LLeg | |
245 | bis4.Attachment0 = at4 | |
246 | bis4.Attachment1 = at4p2 | |
247 | bis4.LimitsEnabled = true | |
248 | bis4.UpperAngle = 180-15 | |
249 | bis4.Visible = vis2 | |
250 | table.insert(js,1,bis4) | |
251 | end | |
252 | ||
253 | if head and not headless and not head:FindFirstChild('Dismembered') then | |
254 | local at5 = Instance.new("Attachment") | |
255 | at5.Parent = torso | |
256 | at5.Visible = vis | |
257 | at5.Orientation = torso.Orientation + Vector3.new(180,90,0) | |
258 | at5.Position = Vector3.new(0,1,0) | |
259 | ||
260 | local at5p2 = Instance.new("Attachment") | |
261 | at5p2.Parent = head | |
262 | at5p2.Visible = vis | |
263 | at5p2.Orientation = head.Orientation + Vector3.new(180,90,0) | |
264 | at5p2.Position = Vector3.new(0,-.5,0) | |
265 | ||
266 | local bis5 = Instance.new("BallSocketConstraint") | |
267 | bis5.Parent = head | |
268 | bis5.Attachment0 = at5p2 | |
269 | bis5.Attachment1 = at5 | |
270 | bis5.LimitsEnabled = true | |
271 | bis5.UpperAngle = 75 | |
272 | bis5.Visible = vis2 | |
273 | bis5.TwistLimitsEnabled = true | |
274 | bis5.UpperAngle = -45 | |
275 | bis5.TwistLowerAngle = -45 | |
276 | table.insert(js,1,bis5) | |
277 | else | |
278 | --head:BreakJoints() | |
279 | end | |
280 | end | |
281 | else | |
282 | hum.Died:Connect(function() | |
283 | if hum.RigType==Enum.HumanoidRigType.R6 then | |
284 | for _,v in pairs(torso:GetDescendants()) do | |
285 | if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA('Weld') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then | |
286 | if not kill then | |
287 | table.insert(js2,1,{obj = v,par = v.Parent}) | |
288 | v.Parent = nil | |
289 | elseif kill then | |
290 | v:Destroy() | |
291 | end | |
292 | end | |
293 | end | |
294 | local vis = false | |
295 | local vis2 = false | |
296 | if LArm and not LArm:FindFirstChild('Dismembered') then | |
297 | local at1 = Instance.new("Attachment") | |
298 | at1.Parent = torso | |
299 | at1.Visible = vis | |
300 | at1.Orientation = torso.Orientation + Vector3.new(0,180,0) | |
301 | at1.Position = Vector3.new(-1,1,0) | |
302 | ||
303 | local at1p2 = Instance.new("Attachment") | |
304 | at1p2.Parent = LArm | |
305 | at1p2.Visible = vis | |
306 | at1p2.Orientation = LArm.Orientation + Vector3.new(0,180,0) | |
307 | at1p2.Position = Vector3.new(.5,1,0) | |
308 | ||
309 | local bis = Instance.new("BallSocketConstraint") | |
310 | bis.Parent = LArm | |
311 | bis.Attachment0 = at1 | |
312 | bis.Attachment1 = at1p2 | |
313 | bis.LimitsEnabled = true | |
314 | bis.UpperAngle = 15 | |
315 | bis.Visible = vis2 | |
316 | bis.TwistLimitsEnabled = true | |
317 | bis.UpperAngle = -45 | |
318 | bis.TwistLowerAngle = -45 | |
319 | table.insert(js,1,bis) | |
320 | end | |
321 | if RArm and not RArm:FindFirstChild('Dismembered') then | |
322 | local at2 = Instance.new("Attachment") | |
323 | at2.Parent = torso | |
324 | at2.Visible = vis | |
325 | at2.Orientation = torso.Orientation + Vector3.new(0,0,0) | |
326 | at2.Position = Vector3.new(1,1,0) | |
327 | ||
328 | local at2p2 = Instance.new("Attachment") | |
329 | at2p2.Parent = RArm | |
330 | at2p2.Visible = vis | |
331 | at2p2.Orientation = RArm.Orientation + Vector3.new(0,0,0) | |
332 | at2p2.Position = Vector3.new(-.5,1,0) | |
333 | ||
334 | local bis2 = Instance.new("BallSocketConstraint") | |
335 | bis2.Parent = RArm | |
336 | bis2.Attachment0 = at2 | |
337 | bis2.Attachment1 = at2p2 | |
338 | bis2.LimitsEnabled = true | |
339 | bis2.UpperAngle = 15 | |
340 | bis2.Visible = vis2 | |
341 | bis2.TwistLimitsEnabled = true | |
342 | bis2.UpperAngle = -45 | |
343 | bis2.TwistLowerAngle = -45 | |
344 | table.insert(js,1,bis2) | |
345 | end | |
346 | if RLeg and not RLeg:FindFirstChild('Dismembered') then | |
347 | local at3 = Instance.new("Attachment") | |
348 | at3.Parent = torso | |
349 | at3.Visible = vis | |
350 | at3.Orientation = torso.Orientation + Vector3.new(90,0,-90) | |
351 | at3.Position = Vector3.new(.5,-1,0) | |
352 | ||
353 | local at3p2 = Instance.new("Attachment") | |
354 | at3p2.Parent = RLeg | |
355 | at3p2.Visible = vis | |
356 | at3p2.Orientation = RLeg.Orientation + Vector3.new(90,0,-90) | |
357 | at3p2.Position = Vector3.new(0,1,0) | |
358 | ||
359 | local bis3 = Instance.new("BallSocketConstraint") | |
360 | bis3.Parent = RLeg | |
361 | bis3.Attachment0 = at3 | |
362 | bis3.Attachment1 = at3p2 | |
363 | bis3.LimitsEnabled = true | |
364 | bis3.UpperAngle = 180-15 | |
365 | bis3.Visible = vis2 | |
366 | table.insert(js,1,bis3) | |
367 | end | |
368 | ||
369 | if LLeg and not LLeg:FindFirstChild('Dismembered') then | |
370 | local at4 = Instance.new("Attachment") | |
371 | at4.Parent = torso | |
372 | at4.Visible = vis | |
373 | at4.Orientation = torso.Orientation + Vector3.new(90,0,-90) | |
374 | at4.Position = Vector3.new(-.5,-1,0) | |
375 | ||
376 | local at4p2 = Instance.new("Attachment") | |
377 | at4p2.Parent = LLeg | |
378 | at4p2.Visible = vis | |
379 | at4p2.Orientation = LLeg.Orientation + Vector3.new(90,0,-90) | |
380 | at4p2.Position = Vector3.new(0,1,0) | |
381 | ||
382 | local bis4 = Instance.new("BallSocketConstraint") | |
383 | bis4.Parent = LLeg | |
384 | bis4.Attachment0 = at4 | |
385 | bis4.Attachment1 = at4p2 | |
386 | bis4.LimitsEnabled = true | |
387 | bis4.UpperAngle = 180-15 | |
388 | bis4.Visible = vis2 | |
389 | table.insert(js,1,bis4) | |
390 | end | |
391 | ||
392 | if head and not headless and not head:FindFirstChild('Dismembered') then | |
393 | local at5 = Instance.new("Attachment") | |
394 | at5.Parent = torso | |
395 | at5.Visible = vis | |
396 | at5.Orientation = torso.Orientation + Vector3.new(180,90,0) | |
397 | at5.Position = Vector3.new(0,1,0) | |
398 | ||
399 | local at5p2 = Instance.new("Attachment") | |
400 | at5p2.Parent = head | |
401 | at5p2.Visible = vis | |
402 | at5p2.Orientation = head.Orientation + Vector3.new(180,90,0) | |
403 | at5p2.Position = Vector3.new(0,-.5,0) | |
404 | ||
405 | local bis5 = Instance.new("BallSocketConstraint") | |
406 | bis5.Parent = head | |
407 | bis5.Attachment0 = at5p2 | |
408 | bis5.Attachment1 = at5 | |
409 | bis5.LimitsEnabled = true | |
410 | bis5.UpperAngle = 75 | |
411 | bis5.Visible = vis2 | |
412 | bis5.TwistLimitsEnabled = true | |
413 | bis5.UpperAngle = -45 | |
414 | bis5.TwistLowerAngle = -45 | |
415 | table.insert(js,1,bis5) | |
416 | else | |
417 | --head:BreakJoints() | |
418 | end | |
419 | end | |
420 | end) | |
421 | end | |
422 | elseif head and hum then | |
423 | hum.BreakJointsOnDeath = false | |
424 | if insta then | |
425 | if hum.RigType==Enum.HumanoidRigType.R15 then | |
426 | for _,v in pairs(pc:GetDescendants()) do | |
427 | if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then | |
428 | if not kill then | |
429 | table.insert(js2,1,{obj = v,par = v.Parent}) | |
430 | v.Parent = nil | |
431 | elseif kill then | |
432 | v:Destroy() | |
433 | end | |
434 | end | |
435 | end | |
436 | local vis = false | |
437 | local vis2 = false | |
438 | ||
439 | if LF and not LF:FindFirstChild('Dismembered') then | |
440 | local bsc1 = Instance.new("BallSocketConstraint",LF) | |
441 | bsc1.Attachment0 = LF.LeftAnkleRigAttachment | |
442 | bsc1.Attachment1 = LLL.LeftAnkleRigAttachment | |
443 | table.insert(js,1,bsc1) | |
444 | end | |
445 | if LLL and not LLL:FindFirstChild('Dismembered') then | |
446 | local bsc2 = Instance.new("BallSocketConstraint",LLL) | |
447 | bsc2.Attachment0 = LLL.LeftKneeRigAttachment | |
448 | bsc2.Attachment1 = LUL.LeftKneeRigAttachment | |
449 | table.insert(js,1,bsc2) | |
450 | end | |
451 | if LUL and not LUL:FindFirstChild('Dismembered') then | |
452 | local bsc3 = Instance.new("BallSocketConstraint",LUL) | |
453 | bsc3.Attachment0 = LUL.LeftHipRigAttachment | |
454 | bsc3.Attachment1 = LT.LeftHipRigAttachment | |
455 | table.insert(js,1,bsc3) | |
456 | end | |
457 | if RF and not RF:FindFirstChild('Dismembered') then | |
458 | local bsc4 = Instance.new("BallSocketConstraint",RF) | |
459 | bsc4.Attachment0 = RF.RightAnkleRigAttachment | |
460 | bsc4.Attachment1 = RLL.RightAnkleRigAttachment | |
461 | table.insert(js,1,bsc4) | |
462 | end | |
463 | if RLL and not RLL:FindFirstChild('Dismembered') then | |
464 | local bsc5 = Instance.new("BallSocketConstraint",RLL) | |
465 | bsc5.Attachment0 = RLL.RightKneeRigAttachment | |
466 | bsc5.Attachment1 = RUL.RightKneeRigAttachment | |
467 | table.insert(js,1,bsc5) | |
468 | end | |
469 | if RUL and not RUL:FindFirstChild('Dismembered') then | |
470 | local bsc6 = Instance.new("BallSocketConstraint",RUL) | |
471 | bsc6.Attachment0 = RUL.RightHipRigAttachment | |
472 | bsc6.Attachment1 = LT.RightHipRigAttachment | |
473 | table.insert(js,1,bsc6) | |
474 | end | |
475 | if LH and not LH:FindFirstChild('Dismembered') then | |
476 | local bsc7 = Instance.new("BallSocketConstraint",LH) | |
477 | bsc7.Attachment0 = LH.LeftWristRigAttachment | |
478 | bsc7.Attachment1 = LLA.LeftWristRigAttachment | |
479 | table.insert(js,1,bsc7) | |
480 | end | |
481 | if LLA and not LLA:FindFirstChild('Dismembered') then | |
482 | local bsc8 = Instance.new("BallSocketConstraint",LLA) | |
483 | bsc8.Attachment0 = LLA.LeftElbowRigAttachment | |
484 | bsc8.Attachment1 = LUA.LeftElbowRigAttachment | |
485 | table.insert(js,1,bsc8) | |
486 | end | |
487 | if LUA and not LUA:FindFirstChild('Dismembered') then | |
488 | local bsc9 = Instance.new("BallSocketConstraint",LUA) | |
489 | bsc9.Attachment0 = LUA.LeftShoulderAttachment | |
490 | bsc9.Attachment1 = UT.LeftCollarAttachment | |
491 | table.insert(js,1,bsc9) | |
492 | end | |
493 | if RH and not RH:FindFirstChild('Dismembered') then | |
494 | local bsc10 = Instance.new("BallSocketConstraint",RH) | |
495 | bsc10.Attachment0 = RH.RightWristRigAttachment | |
496 | bsc10.Attachment1 = RLA.RightWristRigAttachment | |
497 | table.insert(js,1,bsc10) | |
498 | end | |
499 | if RLA and not RLA:FindFirstChild('Dismembered') then | |
500 | local bsc11 = Instance.new("BallSocketConstraint",RLA) | |
501 | bsc11.Attachment0 = RLA.RightElbowRigAttachment | |
502 | bsc11.Attachment1 = RUA.RightElbowRigAttachment | |
503 | table.insert(js,1,bsc11) | |
504 | end | |
505 | if RUA and not RUA:FindFirstChild('Dismembered') then | |
506 | local bsc12 = Instance.new("BallSocketConstraint",RUA) | |
507 | bsc12.Attachment0 = RUA.RightShoulderAttachment | |
508 | bsc12.Attachment1 = UT.RightCollarAttachment | |
509 | table.insert(js,1,bsc12) | |
510 | end | |
511 | if LT and not LT:FindFirstChild('Dismembered') then | |
512 | local bsc13 = Instance.new("BallSocketConstraint",LT) | |
513 | bsc13.Attachment0 = LT.WaistRigAttachment | |
514 | bsc13.Attachment1 = UT.WaistRigAttachment | |
515 | table.insert(js,1,bsc13) | |
516 | end | |
517 | if head and not headless and not head:FindFirstChild('Dismembered') then | |
518 | local bsc14 = Instance.new("BallSocketConstraint",head) | |
519 | bsc14.Attachment0 = UT.NeckRigAttachment | |
520 | bsc14.Attachment1 = head.NeckRigAttachment | |
521 | bsc14.LimitsEnabled = true | |
522 | bsc14.UpperAngle = -75 | |
523 | bsc14.TwistLimitsEnabled = true | |
524 | bsc14.UpperAngle = -45 | |
525 | bsc14.TwistLowerAngle = -45 | |
526 | table.insert(js,1,bsc14) | |
527 | else | |
528 | --head:BreakJoints() | |
529 | end | |
530 | end | |
531 | else | |
532 | hum.Died:Connect(function() | |
533 | if hum.RigType==Enum.HumanoidRigType.R15 then | |
534 | for _,v in pairs(pc:GetDescendants()) do | |
535 | if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then | |
536 | if not kill then | |
537 | table.insert(js2,1,{obj = v,par = v.Parent}) | |
538 | v.Parent = nil | |
539 | elseif kill then | |
540 | v:Destroy() | |
541 | end | |
542 | end | |
543 | end | |
544 | local vis = false | |
545 | local vis2 = false | |
546 | ||
547 | if LF and not LF:FindFirstChild('Dismembered') then | |
548 | local bsc1 = Instance.new("BallSocketConstraint",LF) | |
549 | bsc1.Attachment0 = LF.LeftAnkleRigAttachment | |
550 | bsc1.Attachment1 = LLL.LeftAnkleRigAttachment | |
551 | table.insert(js,1,bsc1) | |
552 | end | |
553 | if LLL and not LLL:FindFirstChild('Dismembered') then | |
554 | local bsc2 = Instance.new("BallSocketConstraint",LLL) | |
555 | bsc2.Attachment0 = LLL.LeftKneeRigAttachment | |
556 | bsc2.Attachment1 = LUL.LeftKneeRigAttachment | |
557 | table.insert(js,1,bsc2) | |
558 | end | |
559 | if LUL and not LUL:FindFirstChild('Dismembered') then | |
560 | local bsc3 = Instance.new("BallSocketConstraint",LUL) | |
561 | bsc3.Attachment0 = LUL.LeftHipRigAttachment | |
562 | bsc3.Attachment1 = LT.LeftHipRigAttachment | |
563 | table.insert(js,1,bsc3) | |
564 | end | |
565 | if RF and not RF:FindFirstChild('Dismembered') then | |
566 | local bsc4 = Instance.new("BallSocketConstraint",RF) | |
567 | bsc4.Attachment0 = RF.RightAnkleRigAttachment | |
568 | bsc4.Attachment1 = RLL.RightAnkleRigAttachment | |
569 | table.insert(js,1,bsc4) | |
570 | end | |
571 | if RLL and not RLL:FindFirstChild('Dismembered') then | |
572 | local bsc5 = Instance.new("BallSocketConstraint",RLL) | |
573 | bsc5.Attachment0 = RLL.RightKneeRigAttachment | |
574 | bsc5.Attachment1 = RUL.RightKneeRigAttachment | |
575 | table.insert(js,1,bsc5) | |
576 | end | |
577 | if RUL and not RUL:FindFirstChild('Dismembered') then | |
578 | local bsc6 = Instance.new("BallSocketConstraint",RUL) | |
579 | bsc6.Attachment0 = RUL.RightHipRigAttachment | |
580 | bsc6.Attachment1 = LT.RightHipRigAttachment | |
581 | table.insert(js,1,bsc6) | |
582 | end | |
583 | if LH and not LH:FindFirstChild('Dismembered') then | |
584 | local bsc7 = Instance.new("BallSocketConstraint",LH) | |
585 | bsc7.Attachment0 = LH.LeftWristRigAttachment | |
586 | bsc7.Attachment1 = LLA.LeftWristRigAttachment | |
587 | table.insert(js,1,bsc7) | |
588 | end | |
589 | if LLA and not LLA:FindFirstChild('Dismembered') then | |
590 | local bsc8 = Instance.new("BallSocketConstraint",LLA) | |
591 | bsc8.Attachment0 = LLA.LeftElbowRigAttachment | |
592 | bsc8.Attachment1 = LUA.LeftElbowRigAttachment | |
593 | table.insert(js,1,bsc8) | |
594 | end | |
595 | if LUA and not LUA:FindFirstChild('Dismembered') then | |
596 | local bsc9 = Instance.new("BallSocketConstraint",LUA) | |
597 | bsc9.Attachment0 = LUA.LeftShoulderAttachment | |
598 | bsc9.Attachment1 = UT.LeftCollarAttachment | |
599 | table.insert(js,1,bsc9) | |
600 | end | |
601 | if RH and not RH:FindFirstChild('Dismembered') then | |
602 | local bsc10 = Instance.new("BallSocketConstraint",RH) | |
603 | bsc10.Attachment0 = RH.RightWristRigAttachment | |
604 | bsc10.Attachment1 = RLA.RightWristRigAttachment | |
605 | table.insert(js,1,bsc10) | |
606 | end | |
607 | if RLA and not RLA:FindFirstChild('Dismembered') then | |
608 | local bsc11 = Instance.new("BallSocketConstraint",RLA) | |
609 | bsc11.Attachment0 = RLA.RightElbowRigAttachment | |
610 | bsc11.Attachment1 = RUA.RightElbowRigAttachment | |
611 | table.insert(js,1,bsc11) | |
612 | end | |
613 | if RUA and not RUA:FindFirstChild('Dismembered') then | |
614 | local bsc12 = Instance.new("BallSocketConstraint",RUA) | |
615 | bsc12.Attachment0 = RUA.RightShoulderAttachment | |
616 | bsc12.Attachment1 = UT.RightCollarAttachment | |
617 | table.insert(js,1,bsc12) | |
618 | end | |
619 | if LT and not LT:FindFirstChild('Dismembered') then | |
620 | local bsc13 = Instance.new("BallSocketConstraint",LT) | |
621 | bsc13.Attachment0 = LT.WaistRigAttachment | |
622 | bsc13.Attachment1 = UT.WaistRigAttachment | |
623 | table.insert(js,1,bsc13) | |
624 | end | |
625 | if head and not headless and not head:FindFirstChild('Dismembered') then | |
626 | local bsc14 = Instance.new("BallSocketConstraint",head) | |
627 | bsc14.Attachment0 = UT.NeckRigAttachment | |
628 | bsc14.Attachment1 = head.NeckRigAttachment | |
629 | bsc14.LimitsEnabled = true | |
630 | bsc14.UpperAngle = -75 | |
631 | bsc14.TwistLimitsEnabled = true | |
632 | bsc14.UpperAngle = -45 | |
633 | bsc14.TwistLowerAngle = -45 | |
634 | table.insert(js,1,bsc14) | |
635 | else | |
636 | --head:BreakJoints() | |
637 | end | |
638 | end | |
639 | end) | |
640 | end | |
641 | end | |
642 | end | |
643 | return js,js2 | |
644 | end | |
645 | ||
646 | local t = Instance.new("Tool") | |
647 | t.CanBeDropped = false | |
648 | local Part1 = Instance.new("Part") | |
649 | local Sound6 = Instance.new("Sound") | |
650 | t.Name = "Impostor Tool" | |
651 | t.TextureId = "rbxassetid://5701818647" | |
652 | t.Grip = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0) | |
653 | t.GripForward = Vector3.new(-1, -0, -0) | |
654 | t.GripPos = Vector3.new(0, 0, -1.5) | |
655 | t.GripRight = Vector3.new(0, 1, 0) | |
656 | t.GripUp = Vector3.new(0, 0, 1) | |
657 | Part1.Name = "Handle" | |
658 | Part1.Parent = t | |
659 | Part1.CFrame = CFrame.new(214.957138, 4.28734684, -190.317474, 0.0910440385, -0.881099463, 0.464084357, 0.537011683, 0.435894847, 0.722229123, -0.838648558, 0.183463722, 0.512845576) | |
660 | Part1.Orientation = Vector3.new(-46.2400017, 42.1399994, 50.9300003) | |
661 | Part1.Position = Vector3.new(214.957138, 4.28734684, -190.317474) | |
662 | Part1.Rotation = Vector3.new(-54.6199989, 27.6499996, 84.0999985) | |
663 | Part1.Color = Color3.new(0.388235, 0.372549, 0.384314) | |
664 | Part1.Size = Vector3.new() | |
665 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
666 | Part1.BrickColor = BrickColor.new("Dark stone grey") | |
667 | Part1.Locked = true | |
668 | Part1.Transparency = 1 | |
669 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
670 | Part1.brickColor = BrickColor.new("Dark stone grey") | |
671 | Part1.FormFactor = Enum.FormFactor.Plate | |
672 | Part1.formFactor = Enum.FormFactor.Plate | |
673 | Sound6.Name = "Kill" | |
674 | Sound6.Parent = nil | |
675 | Sound6.SoundId = "rbxassetid://5677788502" | |
676 | Sound6.Volume = 2 | |
677 | ||
678 | plr = owner | |
679 | ||
680 | local Tool = t | |
681 | local Handle = Tool:WaitForChild("Handle") | |
682 | Tool.Parent = plr['Backpack'] | |
683 | ||
684 | local tag = Instance.new("ObjectValue") | |
685 | tag.Name = 'par' | |
686 | tag.Value = plr['Backpack'] | |
687 | tag.Parent = t | |
688 | ||
689 | local char = plr.Character | |
690 | local hum = char:FindFirstChildOfClass("Humanoid") | |
691 | local root = char:FindFirstChild("HumanoidRootPart") | |
692 | ||
693 | local Players = game:GetService("Players") | |
694 | local Debris = game:GetService("Debris") | |
695 | ||
696 | local Sounds = { | |
697 | Kill = Sound6, | |
698 | } | |
699 | ||
700 | local function CheckIfAlive() | |
701 | return (((plr and plr.Parent and char and char.Parent and hum and hum.Parent and hum.Health > 0 and root and root.Parent) and true) or false) | |
702 | end | |
703 | ||
704 | local can_kill = true | |
705 | local kill_cooldown = 10 | |
706 | local kill_distance = 10 | |
707 | ||
708 | local function kill(Hit,dist) | |
709 | if not Hit or not Hit.Parent or not CheckIfAlive() then | |
710 | return | |
711 | end | |
712 | local character = Hit.Parent | |
713 | if character == char then | |
714 | return | |
715 | end | |
716 | local humanoid = character:FindFirstChildOfClass("Humanoid") | |
717 | if not humanoid or humanoid.Health == 0 then | |
718 | return | |
719 | end | |
720 | local player = Players:GetPlayerFromCharacter(character) | |
721 | if player and ((player == plr)) then | |
722 | return | |
723 | end | |
724 | if can_kill then | |
725 | local sp = Instance.new("Part") | |
726 | sp.Size = Vector3.new() | |
727 | sp.Transparency = 1 | |
728 | sp.CanCollide = false | |
729 | sp.Anchored = true | |
730 | sp.Locked = true | |
731 | sp.Position = root.Position | |
732 | sp.Parent = script | |
733 | local s1 = Sounds.Kill:Clone() | |
734 | s1.Parent = sp | |
735 | s1:Play() | |
736 | spawn(function() | |
737 | root.Anchored = true | |
738 | local sv = root.Velocity | |
739 | local trans = {} | |
740 | for i,v in pairs(char:GetDescendants()) do | |
741 | if (v:IsA("BasePart") or v:IsA("UnionOperation")) and 0 >= v.Transparency then | |
742 | trans[v] = true | |
743 | game:GetService("TweenService"):Create(v,TweenInfo.new(0.1),{Transparency = 1}):Play() | |
744 | end | |
745 | end | |
746 | game:GetService("TweenService"):Create(root,TweenInfo.new(0.1),{CFrame = Hit.CFrame}):Play() | |
747 | humanoid:TakeDamage(1/0) | |
748 | wait(0.1) | |
749 | for i,v in pairs(trans) do | |
750 | game:GetService("TweenService"):Create(i,TweenInfo.new(0.1),{Transparency = 0}):Play() | |
751 | end | |
752 | root.Anchored = false | |
753 | root.Velocity = sv | |
754 | local tempkillval = Instance.new("ObjectValue") | |
755 | tempkillval.Name = 'killer' | |
756 | tempkillval.Value = nil -- plr | |
757 | tempkillval.Parent = humanoid | |
758 | humanoid:TakeDamage(1/0) | |
759 | local ragval = Instance.new("ObjectValue") | |
760 | ragval.Name = 'Ragdolled' | |
761 | ragval.Parent = humanoid | |
762 | humanoid.AutoRotate = false | |
763 | humanoid.PlatformStand = true | |
764 | Ragdoll(character,true,true,true) | |
765 | end) | |
766 | spawn(function() | |
767 | can_kill = false | |
768 | Tool.Parent = nil | |
769 | wait(kill_cooldown) | |
770 | if not char or not hum or not root or 0 >= hum.Health then | |
771 | repeat | |
772 | wait(1) | |
773 | char = plr.Character | |
774 | hum = char:FindFirstChildOfClass("Humanoid") | |
775 | root = char:FindFirstChild("HumanoidRootPart") | |
776 | until char and hum and root and hum.Health > 0 | |
777 | end | |
778 | Tool.Parent = plr['Backpack'] | |
779 | can_kill = true | |
780 | end) | |
781 | end | |
782 | end | |
783 | ||
784 | local function get_near() | |
785 | local dist = kill_distance | |
786 | local near = nil | |
787 | for i,v in pairs(workspace:GetChildren()) do | |
788 | if v ~= char then else continue end | |
789 | local tc = v | |
790 | local tt = nil | |
791 | local th = nil | |
792 | pcall(function() | |
793 | tt = tc:FindFirstChild("HumanoidRootPart") or tc:FindFirstChild("Torso") or tc:FindFirstChild("Head") | |
794 | end) | |
795 | pcall(function() | |
796 | th = tc:FindFirstChildOfClass("Humanoid") | |
797 | end) | |
798 | if tc and tt and th and th.Health > 0 then | |
799 | local cdi = (tt.Position-root.Position).Magnitude | |
800 | if dist >= cdi then | |
801 | dist = cdi | |
802 | near = tt | |
803 | end | |
804 | end | |
805 | end | |
806 | return near,dist | |
807 | end | |
808 | ||
809 | Tool.Equipped:Connect(function() | |
810 | local near,dist = get_near() | |
811 | if not near then | |
812 | wait(0) | |
813 | if not can_kill then | |
814 | Tool.Parent = nil | |
815 | else | |
816 | if not char or not hum or not root or 0 >= hum.Health then | |
817 | repeat | |
818 | wait(1) | |
819 | char = plr.Character | |
820 | hum = char:FindFirstChildOfClass("Humanoid") | |
821 | root = char:FindFirstChild("HumanoidRootPart") | |
822 | until char and hum and root and hum.Health > 0 | |
823 | end | |
824 | Tool.Parent = plr['Backpack'] | |
825 | end | |
826 | else | |
827 | kill(near) | |
828 | end | |
829 | end) | |
830 | local d = game.Players.lafur2.Character:GetChildren() | |
831 | for i=1, #d do | |
832 | if (d[i].className == "Hat") then | |
833 | d[i]:remove() | |
834 | end | |
835 | end | |
836 | ||
837 | for i=1, #d do | |
838 | if (d[i].className == "Accessory") then | |
839 | d[i]:remove() | |
840 | end | |
841 | end | |
842 | ||
843 | local LA = Instance.new("SpecialMesh") | |
844 | local RA = Instance.new("SpecialMesh") | |
845 | local LL = Instance.new("SpecialMesh") | |
846 | local RL = Instance.new("SpecialMesh") | |
847 | local H = Instance.new("SpecialMesh") | |
848 | local T = Instance.new("SpecialMesh") | |
849 | ||
850 | local pl = game.Players.lafur2.Character | |
851 | ||
852 | local la = pl:WaitForChild("Left Arm") | |
853 | local ra = pl:WaitForChild("Right Arm") | |
854 | local ll = pl:WaitForChild("Left Leg") | |
855 | local rl = pl:WaitForChild("Right Leg") | |
856 | local h = pl:WaitForChild("Head") | |
857 | local t = pl:WaitForChild("Torso") | |
858 | ||
859 | ||
860 | LA.Parent = la | |
861 | RA.Parent = ra | |
862 | LL.Parent = ll | |
863 | RL.Parent = rl | |
864 | H.Parent = h | |
865 | T.Parent = t | |
866 | ||
867 | LA.Scale = Vector3.new(0,0,0) | |
868 | RA.Scale = Vector3.new(0,0,0) | |
869 | LA.Offset = Vector3.new(-1,0,0) | |
870 | RA.Offset = Vector3.new(1,0,0) | |
871 | LA.MeshType = Enum.MeshType.Sphere | |
872 | RA.MeshType = Enum.MeshType.Sphere | |
873 | RL.MeshType = Enum.MeshType.Head | |
874 | LL.MeshType = Enum.MeshType.Head | |
875 | ||
876 | T.Scale = Vector3.new(1.5,2,2.5) | |
877 | T.MeshType = Enum.MeshType.Sphere | |
878 | ||
879 | H.Scale = Vector3.new(1,1.25,1.5) | |
880 | H.Offset = Vector3.new(0,-0.75,-0.75) | |
881 | H.MeshType = Enum.MeshType.Sphere | |
882 | ||
883 | local COLOR = BrickColor.Random() | |
884 | ||
885 | la.BrickColor = COLOR | |
886 | ra.BrickColor = COLOR | |
887 | ll.BrickColor = COLOR | |
888 | rl.BrickColor = COLOR | |
889 | h.BrickColor = BrickColor.new("Toothpaste") | |
890 | h.Reflectance = 0.5 | |
891 | t.BrickColor = COLOR | |
892 | ||
893 | h.face:Destroy() | |
894 | ||
895 | la.TopSurface = Enum.SurfaceType.Smooth | |
896 | la.BottomSurface = Enum.SurfaceType.Smooth | |
897 | la.LeftSurface = Enum.SurfaceType.Smooth | |
898 | la.RightSurface = Enum.SurfaceType.Smooth | |
899 | la.FrontSurface = Enum.SurfaceType.Smooth | |
900 | la.BackSurface = Enum.SurfaceType.Smooth | |
901 | ||
902 | ra.TopSurface = Enum.SurfaceType.Smooth | |
903 | ra.BottomSurface = Enum.SurfaceType.Smooth | |
904 | ra.LeftSurface = Enum.SurfaceType.Smooth | |
905 | ra.RightSurface = Enum.SurfaceType.Smooth | |
906 | ra.FrontSurface = Enum.SurfaceType.Smooth | |
907 | ra.BackSurface = Enum.SurfaceType.Smooth | |
908 | ||
909 | ll.TopSurface = Enum.SurfaceType.Smooth | |
910 | ll.BottomSurface = Enum.SurfaceType.Smooth | |
911 | ll.LeftSurface = Enum.SurfaceType.Smooth | |
912 | ll.RightSurface = Enum.SurfaceType.Smooth | |
913 | ll.FrontSurface = Enum.SurfaceType.Smooth | |
914 | ll.BackSurface = Enum.SurfaceType.Smooth | |
915 | ||
916 | rl.TopSurface = Enum.SurfaceType.Smooth | |
917 | rl.BottomSurface = Enum.SurfaceType.Smooth | |
918 | rl.LeftSurface = Enum.SurfaceType.Smooth | |
919 | rl.RightSurface = Enum.SurfaceType.Smooth | |
920 | rl.FrontSurface = Enum.SurfaceType.Smooth | |
921 | rl.BackSurface = Enum.SurfaceType.Smooth | |
922 | ||
923 | t.TopSurface = Enum.SurfaceType.Smooth | |
924 | t.BottomSurface = Enum.SurfaceType.Smooth | |
925 | t.LeftSurface = Enum.SurfaceType.Smooth | |
926 | t.RightSurface = Enum.SurfaceType.Smooth | |
927 | t.FrontSurface = Enum.SurfaceType.Smooth | |
928 | t.BackSurface = Enum.SurfaceType.Smooth | |
929 | ||
930 | h.TopSurface = Enum.SurfaceType.Smooth | |
931 | h.BottomSurface = Enum.SurfaceType.Smooth | |
932 | h.LeftSurface = Enum.SurfaceType.Smooth | |
933 | h.RightSurface = Enum.SurfaceType.Smooth | |
934 | h.FrontSurface = Enum.SurfaceType.Smooth | |
935 | h.BackSurface = Enum.SurfaceType.Smooth |