View difference between Paste ID: QY4tMp0A and R4j7XHqJ
SHOW: | | - or go back to the newest paste.
1
--By Rufus14
2
script.Name = "Gunnnn"
3
script.Parent = owner.Character
4
--Converted with ttyyuu12345's model to script plugin v4
5
function sandbox(var,func)
6
	local env = getfenv(func)
7
	local newenv = setmetatable({},{
8
		__index = function(self,k)
9
			if k=="script" then
10
				return var
11
			else
12
				return env[k]
13
			end
14
		end,
15
	})
16
	setfenv(func,newenv)
17
	return func
18
end
19
cors = {}
20
mas = Instance.new("Model",game:GetService("Lighting"))
21
Tool0 = Instance.new("Tool")
22
Part1 = Instance.new("Part")
23
SpecialMesh2 = Instance.new("SpecialMesh")
24
Sound3 = Instance.new("Sound")
25
Sound4 = Instance.new("Sound")
26
Sound5 = Instance.new("Sound")
27
Sound6 = Instance.new("Sound")
28
Sound7 = Instance.new("Sound")
29
Sound8 = Instance.new("Sound")
30
Sound9 = Instance.new("Sound")
31
Sound10 = Instance.new("Sound")
32
RemoteEvent11 = Instance.new("RemoteEvent")
33
Tool0.Name = "Pistol"
34
Tool0.Parent = mas
35
Tool0.TextureId = "rbxassetid://168510890"
36
Tool0.CanBeDropped = false
37
Tool0.Grip = CFrame.new(-0.0662693828, -0.275076389, -0.4518933, -0.998969376, 0, 0.0453881398, 0, 1, 0, -0.0453881398, 0, -0.998969376)
38
Tool0.GripForward = Vector3.new(-0.0453881398, -0, 0.998969376)
39
Tool0.GripPos = Vector3.new(-0.0662693828, -0.275076389, -0.4518933)
40
Tool0.GripRight = Vector3.new(-0.998969376, 0, -0.0453881398)
41
Tool0.ToolTip = "Gun to kill skids."
42
Part1.Name = "Handle"
43
Part1.Material = Enum.Material.Metal
44
Part1.Parent = Tool0
45
Part1.CFrame = CFrame.new(1.84143364, 0.946836948, -16.1359825, 1, 0, 0, 0, 1, 0, 0, 0, 1)
46
Part1.Position = Vector3.new(1.84143364, 999999, -16.1359825)
47
Part1.Size = Vector3.new(0.230000198, 0.0500000007, 0.290000528)
48
Part1.BottomSurface = Enum.SurfaceType.Smooth
49
Part1.TopSurface = Enum.SurfaceType.Smooth
50
SpecialMesh2.Parent = Part1
51
SpecialMesh2.MeshId = "rbxassetid://436697873"
52
SpecialMesh2.Scale = Vector3.new(0.0299999993, 0.0299999993, 0.0299999993)
53
SpecialMesh2.TextureId = "rbxassetid://436697889"
54
SpecialMesh2.MeshType = Enum.MeshType.FileMesh
55
Sound3.Name = "shatter"
56-
Sound3.SoundId = "rbxassetid://2978605361"
56+
57
Sound3.SoundId = "rbxassetid://2596202821"
58
Sound3.PlaybackSpeed = 2
59
Sound4.Name = "gunshot"
60-
Sound4.Pitch = 1.2000000476837
60+
61-
Sound4.PlaybackSpeed = 1.2000000476837
61+
Sound4.Pitch = 1.55
62-
Sound4.SoundId = "rbxassetid://2400424487"
62+
Sound4.PlaybackSpeed = 1.55
63
Sound4.SoundId = "rbxassetid://1265552868"
64
Sound4.Volume = 10
65-
Sound5.SoundId = "rbxassetid://1347142405"
65+
66
Sound5.Parent = Part1
67
Sound5.SoundId = "rbxassetid://179235828"
68-
Sound6.SoundId = "rbxassetid://291256829"
68+
69
Sound6.Parent = Part1
70
Sound6.SoundId = "rbxassetid://240784215"
71-
Sound7.SoundId = "rbxassetid://769464514"
71+
72
Sound7.Parent = Part1
73
Sound7.SoundId = "rbxassetid://1498950813"
74
Sound8.Name = "supersonic bullet crack"
75
Sound8.Parent = Part1
76
Sound8.EmitterSize = 1
77
Sound8.MinDistance = 1
78
Sound8.Pitch = 1.5
79-
Sound8.Volume = 1
79+
80
Sound8.SoundId = "rbxassetid://259586543"
81
Sound8.Volume = 10
82-
Sound9.SoundId = "rbxassetid://3092866899"
82+
83
Sound9.Parent = Part1
84
Sound9.SoundId = "rbxassetid://1565725028"
85-
Sound10.SoundId = "rbxassetid://1489924400"
85+
Sound9.Volume = 0.453
86
Sound10.Name = "bullethit"
87
Sound10.Parent = Part1
88
Sound10.SoundId = "rbxassetid://151130059"
89
RemoteEvent11.Name = "GunEvent"
90
RemoteEvent11.Parent = Tool0
91
for i,v in pairs(mas:GetChildren()) do
92
	v.Parent = script
93
	pcall(function() v:MakeJoints() end)
94
end
95
mas:Destroy()
96
for i,v in pairs(cors) do
97
	spawn(function()
98
		pcall(v)
99
	end)
100
end
101
Tool0.Parent = script
102
NLS([[
103
game:GetService("Players").LocalPlayer.Character:WaitForChild("Gunnnn")
104
game:GetService("Players").LocalPlayer.Character.Gunnnn.Pistol:WaitForChild("GunEvent")
105
print("script ran")
106
tool = game:GetService("Players").LocalPlayer.Character.Gunnnn.Pistol
107
playermouse = game:GetService("Players").LocalPlayer:GetMouse()
108
runservice = game:GetService("RunService").RenderStepped
109
gunevent = tool.GunEvent
110
function onpress()
111
	gunevent:FireServer("shoot", playermouse.Hit.p, playermouse.Origin.p)
112
end
113
tool.Activated:connect(onpress)
114
function removearms()
115
	if game:GetService("Players").LocalPlayer.Character.Torso:findFirstChild("RightArmWeld") then
116
		game:GetService("Players").LocalPlayer.Character.Torso:findFirstChild("RightArmWeld"):destroy()
117
	end
118
	if game:GetService("Players").LocalPlayer.Character.Torso:findFirstChild("HeadWeld") then
119
		game:GetService("Players").LocalPlayer.Character.Torso:findFirstChild("HeadWeld"):destroy()
120
	end
121
	if game:GetService("Players").LocalPlayer.Character.Torso:findFirstChild("LeftArmWeld") then
122
		game:GetService("Players").LocalPlayer.Character.Torso:findFirstChild("LeftArmWeld"):destroy()
123
	end
124
	if game:GetService("Players").LocalPlayer.Character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeld") then
125
		game:GetService("Players").LocalPlayer.Character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeld"):destroy()
126
	end
127
end
128
tool.Unequipped:connect(removearms)
129
while runservice:wait() do
130
	if tool.Parent == game:GetService("Players").LocalPlayer.Character then
131
		if (workspace.CurrentCamera.CFrame.p - game:GetService("Players").LocalPlayer.Character.Head.Position).magnitude < 1.3 then
132
			if game:GetService("Players").LocalPlayer.Character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeld") then
133
				gunevent:FireServer("point", playermouse.Hit.p, playermouse.Origin.p)
134
				game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.HumanoidRootPartWeld.C0 = CFrame.fromEulerAnglesXYZ(0,math.pi/3,0)
135
			else
136
				local humanoidrootpart = Instance.new("Weld", game:GetService("Players").LocalPlayer.Character.HumanoidRootPart)
137
				humanoidrootpart.Part0 = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart
138
				humanoidrootpart.Part1 = game:GetService("Players").LocalPlayer.Character.Torso
139
				humanoidrootpart.Name = "HumanoidRootPartWeld"
140
			end
141
		else
142
			if game:GetService("Players").LocalPlayer.Character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeld") then
143
				game:GetService("Players").LocalPlayer.Character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeld"):destroy()
144
			end
145
			gunevent:FireServer("point", playermouse.Hit.p, playermouse.Origin.p)
146
			game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position,Vector3.new(playermouse.Hit.p.x,game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position.y,playermouse.Hit.p.z)) * CFrame.fromEulerAnglesXYZ(0,math.pi/3,0)
147
		end
148
	end
149
end
150
]], owner.Character)
151
wait(0.8)
152
--By Rufus14
153
canuse = true
154
heartbeat = game:GetService("RunService").Heartbeat
155
tool = Tool0
156
handle = Part1
157
shoot = handle.gunshot
158
shattersound = handle.shatter
159
empty = handle.empty
160
shootevent = tool.GunEvent
161
equip = handle.equip
162
unequip = handle.unequip
163
bullethitflesh = handle.bullethitflesh
164
bullethit = handle.bullethit
165
bulletcrack = handle["supersonic bullet crack"]
166
function positiongun()
167
	equip:Play()
168
end
169
function resetgun()
170
	unequip:Play()
171
end
172
tool.Unequipped:connect(resetgun)
173
tool.Equipped:connect(positiongun)
174
Tool0.Parent = owner.Character
175
function dosomething(plr, whataction, pos, origin)
176
	if whataction == "shoot" then
177
		if canuse then
178
			canuse = false
179
			shoot:Play()
180
			for i = 1,10 do
181
				plr.Character.Torso:findFirstChild("RightArmWeld").C1 = plr.Character.Torso:findFirstChild("RightArmWeld").C1 * CFrame.fromEulerAnglesXYZ(-0.055,0,0)
182
			end
183
			local light = Instance.new("PointLight", handle)
184
			light.Brightness = 10
185
			local ray = Ray.new(handle.Position, (pos - handle.Position).unit * 400)
186
			local hit, position = workspace:FindPartOnRayWithIgnoreList(ray, {handle, tool.Parent["Right Arm"]})
187
			local part = Instance.new("Part", handle)
188
			part.Anchored = true
189
			part.CanCollide = false
190
			part.Material = "Neon"
191
			part.Size = Vector3.new(0,0,(handle.Position - position).magnitude/4)
192
			part.CFrame = CFrame.new(handle.Position, position) * CFrame.new(0,0,-(handle.Position - position).magnitude/2)
193
			local function hide()
194
				bulletcrack.Parent = part
195
				bulletcrack:Play()
196
				bulletcrack.MaxDistance = part.Size.z
197
				wait(0.01)
198
				part.Transparency = 1
199
				wait(bulletcrack.TimeLength - 0.01)
200
				bulletcrack.Parent = handle
201
				part:destroy()
202
			end
203
			spawn(hide)
204
			game.Debris:AddItem(light, 0.04)
205
			local function makewound(hitt)
206
				local ball = Instance.new("Part", hitt.Parent)
207
				ball.Shape = "Ball"
208
				ball.Name = "ouchwound"
209
				ball.Transparency = hitt.Transparency
210
				ball.CanCollide = false
211
				ball.Size = Vector3.new(0.25,0.25,0.25)
212
				ball.CFrame = CFrame.new(position.x,position.y,position.z)
213
				local hitweld = Instance.new("Weld", hitt)
214
				ball.CFrame = CFrame.new(ball.Position, handle.Position)
215
				hitweld.C0 = hitt.CFrame:toObjectSpace(ball.CFrame)
216
				hitweld.Part0 = hitt
217
				hitweld.Part1 = ball
218
				hitweld.Name = "ouch_weld"
219
				hitweld.C0 = hitweld.C0 * CFrame.new(0,0,0.1)
220
				bullethit.Parent = ball
221
				if hitt.Name == "ouchwound" then
222
					ball.Transparency = 1
223
					local function waittoremove()
224
						wait(3)
225
						ball:destroy()
226
					end
227
					spawn(waittoremove)
228
				end
229
				bullethit:Play()
230
				bullethit.MaxDistance = 10
231
				if hitt.Parent:findFirstChildOfClass("Humanoid") then
232
					if hitt.Parent:findFirstChildOfClass("Humanoid").Health > 0 then
233
						bullethitflesh.Parent = ball
234
						bullethitflesh:Play()
235
						bullethitflesh.MaxDistance = 10
236
						local randomdamage = math.random(40,80)
237
						if hitt.Parent:findFirstChildOfClass("Humanoid").Health > 500 then
238
							hitt.Parent:findFirstChildOfClass("Humanoid").MaxHealth = 500
239
							hitt.Parent:findFirstChildOfClass("Humanoid").Health = 500
240
						end
241
						if hitt.Parent:findFirstChildOfClass("Humanoid").Health <= randomdamage then
242
							local velocity = Instance.new("BodyVelocity", hit)
243
							velocity.MaxForce = Vector3.new(math.huge,0,math.huge)
244
							velocity.Velocity = handle.CFrame.lookVector * -math.random(15,25)
245
							game.Debris:AddItem(velocity, 0.1)
246
							hitt.Parent:findFirstChildOfClass("Humanoid").Health = 0
247
							local function searchforweld(wot)
248
								for i,v in pairs(wot:GetChildren()) do
249
									searchforweld(v)
250
									if v.ClassName == "Weld" or v.ClassName == "Motor6D" and v.Name ~= "ouch_weld" then
251
										v:destroy()
252
									end
253
								end
254
							end
255
							searchforweld(hitt.Parent)
256
							ragdollkill(hitt.Parent)
257
						else
258
							if hitt.Name ~= "Head" then
259
								hitt.Parent:findFirstChildOfClass("Humanoid").Health = hitt.Parent:findFirstChildOfClass("Humanoid").Health - randomdamage
260
								local velocity = Instance.new("BodyVelocity", hit)
261
								velocity.MaxForce = Vector3.new(math.huge,0,math.huge)
262
								velocity.Velocity = handle.CFrame.lookVector * -math.random(15,25)
263
								game.Debris:AddItem(velocity, 0.1)
264
							else
265
								hitt.Parent:findFirstChildOfClass("Humanoid").Health = 0
266
								local function searchforweld(wot)
267
									for i,v in pairs(wot:GetChildren()) do
268
										searchforweld(v)
269
										if v.ClassName == "Weld" or v.ClassName == "Motor6D" and v.Name ~= "ouch_weld" then
270
											v:destroy()
271
										end
272
									end
273
								end
274
								searchforweld(hitt.Parent)
275
								ragdollkill(hitt.Parent)
276
							end
277
						end
278
						local function bbb()
279
							wait(bullethitflesh.TimeLength)
280
							bullethitflesh.Parent = handle
281
						end
282
						spawn(bbb)
283
						ball.BrickColor = BrickColor.new("Maroon")
284
						ball.Material = "Pebble"
285
					end
286
				else
287
					if not hitt.Parent:findFirstChildOfClass("Humanoid") and hitt.Parent.ClassName == "Model" then
288
						hitt:BreakJoints()
289
						local velocity = Instance.new("BodyVelocity", hitt)
290
						velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
291
						velocity.Velocity = handle.CFrame.lookVector * -math.random(10,30)
292
						local function cancollide()
293
							wait(0.1)
294
							hitt.CanCollide = true
295
							velocity:destroy()
296
						end
297
						spawn(cancollide)
298
					end
299
					ball.BrickColor = hitt.BrickColor
300
					ball.Material = "Cobblestone"
301
					local function fadeaway()
302
						wait(20)
303
						for i = 1,100 do
304
							ball.Transparency = ball.Transparency + 0.01
305
							wait()
306
						end
307
						ball:destroy()
308
					end
309
					spawn(fadeaway)
310
				end
311
				local function aaa()
312
					wait(bullethit.TimeLength)
313
					bullethit.Parent = handle
314
				end
315
				spawn(aaa)
316
			end
317
			if hit ~= nil then
318
				if hit.Parent ~= nil then
319
					if not hit.Parent:findFirstChildOfClass("Humanoid") and not hit:findFirstChild("shattered") and not hit.Name ~= "HumanoidRootPart" and hit.Transparency > 0.1 then
320
						if hit.Size.z < hit.Size.x then
321
							if hit.Size.z <= 1.5 then
322
								local sha = Instance.new("BoolValue", hit)
323
								sha.Name = "shattered"
324
								local shatter = Instance.new("Part", workspace)
325
								shatter.Transparency = hit.Transparency
326
								shatter.Material = hit.Material
327
								shatter.BrickColor = hit.BrickColor
328
								shatter.Size = Vector3.new(hit.Size.x/2,hit.Size.y/2,hit.Size.z)
329
								shatter.CanCollide = hit.CanCollide
330
								shatter.CFrame = hit.CFrame * CFrame.new(shatter.Size.x/2,shatter.Size.y/2,0)
331
								shatter:BreakJoints()
332
								shatter.Velocity = handle.CFrame.lookVector * -20
333
								game.Debris:AddItem(shatter, 15)
334
								--
335
								local shatter = Instance.new("Part", workspace)
336
								shatter.Transparency = hit.Transparency
337
								shatter.Material = hit.Material
338
								shatter.BrickColor = hit.BrickColor
339
								shatter.Size = Vector3.new(hit.Size.x/2,hit.Size.y/2,hit.Size.z)
340
								shatter.CanCollide = hit.CanCollide
341
								shatter.CFrame = hit.CFrame * CFrame.new(-shatter.Size.x/2,shatter.Size.y/2,0)
342
								shatter:BreakJoints()
343
								shatter.Velocity = handle.CFrame.lookVector * -20
344
								game.Debris:AddItem(shatter, 15)
345
								--
346
								local shatter = Instance.new("Part", workspace)
347
								shatter.Transparency = hit.Transparency
348
								shatter.Material = hit.Material
349
								shatter.BrickColor = hit.BrickColor
350
								shatter.Size = Vector3.new(hit.Size.x/2,hit.Size.y/2,hit.Size.z)
351
								shatter.CanCollide = hit.CanCollide
352
								shatter.CFrame = hit.CFrame * CFrame.new(shatter.Size.x/2,-shatter.Size.y/2,0)
353
								shatter:BreakJoints()
354
								shatter.Velocity = handle.CFrame.lookVector * -20
355
								game.Debris:AddItem(shatter, 15)
356
								--
357
								local shatter = Instance.new("Part", workspace)
358
								shatter.Transparency = hit.Transparency
359
								shatter.Material = hit.Material
360
								shatter.BrickColor = hit.BrickColor
361
								shatter.Size = Vector3.new(hit.Size.x/2,hit.Size.y/2,hit.Size.z)
362
								shatter.CanCollide = hit.CanCollide
363
								shatter.CFrame = hit.CFrame * CFrame.new(-shatter.Size.x/2,-shatter.Size.y/2,0)
364
								shatter:BreakJoints()
365
								shatter.Velocity = handle.CFrame.lookVector * -20
366
								game.Debris:AddItem(shatter, 15)
367
								--
368
								hit.Anchored = true
369
								hit.Transparency = 1
370
								hit.CanCollide = false
371
								local function stopshattering()
372
									shattersound.Parent = hit
373
									shattersound:Play()
374
									shattersound.MaxDistance = 30
375
									game.Debris:AddItem(hit,2)
376
									wait(shattersound.TimeLength/2)
377
									shattersound.Parent = handle
378
								end
379
								spawn(stopshattering)
380
							end
381
						elseif hit.Size.x < hit.Size.z then
382
							if hit.Size.x <= 1.5 then
383
								local sha = Instance.new("BoolValue", hit)
384
								sha.Name = "shattered"
385
								local shatter = Instance.new("Part", workspace)
386
								shatter.Transparency = hit.Transparency
387
								shatter.Material = hit.Material
388
								shatter.BrickColor = hit.BrickColor
389
								shatter.Size = Vector3.new(hit.Size.x,hit.Size.y/2,hit.Size.z/2)
390
								shatter.CanCollide = hit.CanCollide
391
								shatter.CFrame = hit.CFrame * CFrame.new(0,shatter.Size.y/2,shatter.Size.z/2)
392
								shatter:BreakJoints()
393
								shatter.Velocity = handle.CFrame.lookVector * -20
394
								game.Debris:AddItem(shatter, 15)
395
								--
396
								local shatter = Instance.new("Part", workspace)
397
								shatter.Transparency = hit.Transparency
398
								shatter.Material = hit.Material
399
								shatter.BrickColor = hit.BrickColor
400
								shatter.Size = Vector3.new(hit.Size.x,hit.Size.y/2,hit.Size.z/2)
401
								shatter:BreakJoints()
402
								shatter.CanCollide = hit.CanCollide
403
								shatter.CFrame = hit.CFrame * CFrame.new(0,-shatter.Size.y/2,shatter.Size.z/2)
404
								shatter.Velocity = handle.CFrame.lookVector * -20
405
								game.Debris:AddItem(shatter, 15)
406
								--
407
								local shatter = Instance.new("Part", workspace)
408
								shatter.Transparency = hit.Transparency
409
								shatter.Material = hit.Material
410
								shatter.BrickColor = hit.BrickColor
411
								shatter.Size = Vector3.new(hit.Size.x,hit.Size.y/2,hit.Size.z/2)
412
								shatter.CanCollide = hit.CanCollide
413
								shatter.CFrame = hit.CFrame * CFrame.new(0,shatter.Size.y/2,-shatter.Size.z/2)
414
								shatter:BreakJoints()
415
								shatter.Velocity = handle.CFrame.lookVector * -20
416
								game.Debris:AddItem(shatter, 15)
417
								--
418
								local shatter = Instance.new("Part", workspace)
419
								shatter.Transparency = hit.Transparency
420
								shatter.Material = hit.Material
421
								shatter.BrickColor = hit.BrickColor
422
								shatter.Size = Vector3.new(hit.Size.x,hit.Size.y/2,hit.Size.z/2)
423
								shatter.CanCollide = hit.CanCollide
424
								shatter.CFrame = hit.CFrame * CFrame.new(0,-shatter.Size.y/2,-shatter.Size.z/2)
425
								shatter:BreakJoints()
426
								shatter.Velocity = handle.CFrame.lookVector * -20
427
								game.Debris:AddItem(shatter, 15)
428
								--
429
								hit.Anchored = true
430
								hit.Transparency = 1
431
								hit.CanCollide = false
432
								local function stopshattering()
433
									shattersound.Parent = hit
434
									shattersound:Play()
435
									shattersound.MaxDistance = 30
436
									game.Debris:AddItem(hit,2)
437
									wait(shattersound.TimeLength/2)
438
									shattersound.Parent = handle
439
								end
440
								spawn(stopshattering)
441
							end
442
						end
443
					end
444
				end
445
				if hit.Parent.ClassName == "Accessory" or hit.Parent.ClassName == "Hat" then
446
					for i,v in pairs(hit:GetChildren()) do
447
						if v.ClassName == "Attachment" or v.ClassName == "Weld" or v.ClassName == "Motor6D" then
448
							v:destroy()
449
						end
450
					end
451
					hit.Parent.Parent = workspace
452
					hit.CanCollide = false
453
					local velocity = Instance.new("BodyVelocity", hit)
454
					velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
455
					velocity.Velocity = handle.CFrame.lookVector * -math.random(10,30)
456
					local function cancollide()
457
						wait(0.1)
458
						hit.CanCollide = true
459
						velocity:destroy()
460
					end
461
					spawn(cancollide)
462
				else
463
					makewound(hit)
464
				end
465
			end
466
			for i = 1,10 do
467
				if plr.Character.Torso:findFirstChild("RightArmWeld") then
468
					plr.Character.Torso:findFirstChild("RightArmWeld").C1 = plr.Character.Torso:findFirstChild("RightArmWeld").C1 * CFrame.fromEulerAnglesXYZ(0.055,0,0)
469
					heartbeat:wait()
470
				end
471
			end
472
			canuse = true
473
		end
474
	elseif whataction == "point" then
475
		if plr.Character:findFirstChild("Torso") then
476
			if not plr.Character.Torso:findFirstChild("HeadWeld") then
477
				local head = Instance.new("Weld", plr.Character.Torso)
478
				head.Part0 = plr.Character.Torso
479
				head.Part1 = plr.Character.Head
480
				head.C0 = CFrame.new(0,1.5,0)
481
				head.C1 = CFrame.new(0,-0.5,0)
482
				head.Name = "HeadWeld"
483
			end
484
			if not plr.Character.Torso:findFirstChild("RightArmWeld") then
485
				local rightarm = Instance.new("Weld", plr.Character.Torso)
486
				rightarm.Part0 = plr.Character.Torso
487
				rightarm.Part1 = plr.Character["Right Arm"]
488
				rightarm.C0 = CFrame.new(1.5,0,0)
489
				rightarm.C1 = CFrame.new(0,0.5,0)
490
				rightarm.Name = "RightArmWeld"
491
			end
492
			if not plr.Character.Torso:findFirstChild("LeftArmWeld") then
493
				local leftarm = Instance.new("Weld", plr.Character.Torso)
494
				leftarm.Part0 = plr.Character.Torso
495
				leftarm.Part1 = plr.Character["Left Arm"]
496
				leftarm.C0 = CFrame.new(-1.5,0,0)
497
				leftarm.C1 = CFrame.new(0,0.5,0)
498
				leftarm.Name = "LeftArmWeld"
499
			end
500
			if plr.Character.Torso:findFirstChild("RightArmWeld") then
501
				plr.Character.Torso:findFirstChild("RightArmWeld").C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2,0,math.pi/3) * CFrame.fromEulerAnglesXYZ(math.asin((pos-origin).unit.y),0,0)
502
			end
503
			if plr.Character.Torso:findFirstChild("HeadWeld") then
504
				plr.Character.Torso:findFirstChild("HeadWeld").C0 = CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.asin((pos-origin).unit.y),-math.pi/3,0)
505
			end
506
			if plr.Character.Torso:findFirstChild("LeftArmWeld") then
507
				plr.Character.Torso:findFirstChild("LeftArmWeld").C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.asin((pos-origin).unit.y)/2,0,0)
508
			end
509
		end
510
	end
511
end
512
shootevent.OnServerEvent:connect(dosomething)
513
function ragdollkill(character)
514
	local victimshumanoid = character:findFirstChildOfClass("Humanoid")
515
	if not character:findFirstChild("UpperTorso") then
516
		character.Archivable = true
517
		for i,v in pairs(character:GetChildren()) do
518
			if v.ClassName == "Sound" then
519
				v:remove()
520
			end
521
			for q,w in pairs(v:GetChildren()) do
522
				if w.ClassName == "Sound" then
523
					w:remove()
524
				end
525
			end
526
		end
527
		local ragdoll = character:Clone()
528
		ragdoll:findFirstChildOfClass("Humanoid").Health = 0
529
		if ragdoll:findFirstChild("Health") then
530
			if ragdoll:findFirstChild("Health").ClassName == "Script" then
531
				ragdoll:findFirstChild("Health").Disabled = true
532
			end
533
		end
534
		for i,v in pairs(character:GetChildren()) do
535
			if v.ClassName == "Part" or v.ClassName == "ForceField" or v.ClassName == "Accessory" or v.ClassName == "Hat" then
536
				v:destroy()
537
			end
538
		end
539
		for i,v in pairs(character:GetChildren()) do
540
			if v.ClassName == "Accessory" then
541
				local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
542
				if attachment1 then
543
					for q,w in pairs(character:GetChildren()) do
544
						if w.ClassName == "Part" then
545
							local attachment2 = w:findFirstChild(attachment1.Name)
546
							if attachment2 then
547
								local hinge = Instance.new("HingeConstraint", v.Handle)
548
								hinge.Attachment0 = attachment1
549
								hinge.Attachment1 = attachment2
550
								hinge.LimitsEnabled = true
551
								hinge.LowerAngle = 0
552
								hinge.UpperAngle = 0
553
							end
554
						end
555
					end
556
				end
557
			end
558
		end
559
		ragdoll.Parent = workspace
560
		if ragdoll:findFirstChild("Right Arm") then
561
			local glue = Instance.new("Glue", ragdoll.Torso)
562
			glue.Part0 = ragdoll.Torso
563
			glue.Part1 = ragdoll:findFirstChild("Right Arm")
564
			glue.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
565
			glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
566
			local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Arm"))
567
			limbcollider.Size = Vector3.new(1.4,1,1)
568
			limbcollider.Shape = "Cylinder"
569
			limbcollider.Transparency = 1
570
			limbcollider.Name = "LimbCollider"
571
			local limbcolliderweld = Instance.new("Weld", limbcollider)
572
			limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Arm")
573
			limbcolliderweld.Part1 = limbcollider
574
			limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
575
		end
576
		if ragdoll:findFirstChild("Left Arm") then
577
			local glue = Instance.new("Glue", ragdoll.Torso)
578
			glue.Part0 = ragdoll.Torso
579
			glue.Part1 = ragdoll:findFirstChild("Left Arm")
580
			glue.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
581
			glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
582
			local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Arm"))
583
			limbcollider.Size = Vector3.new(1.4,1,1)
584
			limbcollider.Shape = "Cylinder"
585
			limbcollider.Name = "LimbCollider"
586
			limbcollider.Transparency = 1
587
			local limbcolliderweld = Instance.new("Weld", limbcollider)
588
			limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Arm")
589
			limbcolliderweld.Part1 = limbcollider
590
			limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
591
		end
592
		if ragdoll:findFirstChild("Left Leg") then
593
			local glue = Instance.new("Glue", ragdoll.Torso)
594
			glue.Part0 = ragdoll.Torso
595
			glue.Part1 = ragdoll:findFirstChild("Left Leg")
596
			glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
597
			glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
598
			local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Leg"))
599
			limbcollider.Size = Vector3.new(1.4,1,1)
600
			limbcollider.Shape = "Cylinder"
601
			limbcollider.Name = "LimbCollider"
602
			limbcollider.Transparency = 1
603
			local limbcolliderweld = Instance.new("Weld", limbcollider)
604
			limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Leg")
605
			limbcolliderweld.Part1 = limbcollider
606
			limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
607
		end
608
		if ragdoll:findFirstChild("Right Leg") then
609
			local glue = Instance.new("Glue", ragdoll.Torso)
610
			glue.Part0 = ragdoll.Torso
611
			glue.Part1 = ragdoll:findFirstChild("Right Leg")
612
			glue.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
613
			glue.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
614
			local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Leg"))
615
			limbcollider.Size = Vector3.new(1.4,1,1)
616
			limbcollider.Shape = "Cylinder"
617
			limbcollider.Name = "LimbCollider"
618
			limbcollider.Transparency = 1
619
			local limbcolliderweld = Instance.new("Weld", limbcollider)
620
			limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Leg")
621
			limbcolliderweld.Part1 = limbcollider
622
			limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
623
		end
624
		if ragdoll:findFirstChild("Head") and ragdoll.Torso:findFirstChild("NeckAttachment") then
625
			local HeadAttachment = Instance.new("Attachment", ragdoll["Head"])
626
			HeadAttachment.Position = Vector3.new(0, -0.5, 0)
627
			local connection = Instance.new('HingeConstraint', ragdoll["Head"])
628
			connection.LimitsEnabled = true
629
			connection.Attachment0 = ragdoll.Torso.NeckAttachment
630
			connection.Attachment1 = HeadAttachment
631
			connection.UpperAngle = 60
632
			connection.LowerAngle = -60
633
		elseif ragdoll:findFirstChild("Head") and not ragdoll.Torso:findFirstChild("NeckAttachment") then
634
			local hedweld = Instance.new("Weld", ragdoll.Torso)
635
			hedweld.Part0 = ragdoll.Torso
636
			hedweld.Part1 = ragdoll.Head
637
			hedweld.C0 = CFrame.new(0,1.5,0)
638
		end
639
		game.Debris:AddItem(ragdoll, 30)
640
		local function aaaalol()
641
			wait(0.2)
642
			local function searchforvelocity(wot)
643
				for i,v in pairs(wot:GetChildren()) do
644
					searchforvelocity(v)
645
					if v.ClassName == "BodyPosition" or v.ClassName == "BodyVelocity" then
646
						v:destroy()
647
					end
648
				end
649
			end
650
			searchforvelocity(ragdoll)
651
			wait(0.5)
652
			if ragdoll:findFirstChildOfClass("Humanoid") then
653
				ragdoll:findFirstChildOfClass("Humanoid").PlatformStand = true
654
			end
655
			if ragdoll:findFirstChild("HumanoidRootPart") then
656
				ragdoll:findFirstChild("HumanoidRootPart"):destroy()
657
			end
658
		end
659
		spawn(aaaalol)
660
	elseif character:findFirstChild("UpperTorso") then
661
		character.Archivable = true
662
		for i,v in pairs(character:GetChildren()) do
663
			if v.ClassName == "Sound" then
664
				v:remove()
665
			end
666
			for q,w in pairs(v:GetChildren()) do
667
				if w.ClassName == "Sound" then
668
					w:remove()
669
				end
670
			end
671
		end
672
		local ragdoll = character:Clone()
673
		ragdoll:findFirstChildOfClass("Humanoid").Health = 0
674
		if ragdoll:findFirstChild("Health") then
675
			if ragdoll:findFirstChild("Health").ClassName == "Script" then
676
				ragdoll:findFirstChild("Health").Disabled = true
677
			end
678
		end
679
		for i,v in pairs(character:GetChildren()) do
680
			if v.ClassName == "Part" or v.ClassName == "ForceField" or v.ClassName == "Accessory" or v.ClassName == "Hat" or v.ClassName == "MeshPart" then
681
				v:destroy()
682
			end
683
		end
684
		for i,v in pairs(character:GetChildren()) do
685
			if v.ClassName == "Accessory" then
686
				local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
687
				if attachment1 then
688
					for q,w in pairs(character:GetChildren()) do
689
						if w.ClassName == "Part" or w.ClassName == "MeshPart" then
690
							local attachment2 = w:findFirstChild(attachment1.Name)
691
							if attachment2 then
692
								local hinge = Instance.new("HingeConstraint", v.Handle)
693
								hinge.Attachment0 = attachment1
694
								hinge.Attachment1 = attachment2
695
								hinge.LimitsEnabled = true
696
								hinge.LowerAngle = 0
697
								hinge.UpperAngle = 0
698
							end
699
						end
700
					end
701
				end
702
			end
703
		end
704
		ragdoll.Parent = workspace
705
		local Humanoid = ragdoll:findFirstChildOfClass("Humanoid")
706
		Humanoid.PlatformStand = true
707
		local function makeballconnections(limb, attachementone, attachmenttwo, twistlower, twistupper)
708
			local connection = Instance.new('BallSocketConstraint', limb)
709
			connection.LimitsEnabled = true
710
			connection.Attachment0 = attachementone
711
			connection.Attachment1 = attachmenttwo
712
			connection.TwistLimitsEnabled = true
713
			connection.TwistLowerAngle = twistlower
714
			connection.TwistUpperAngle = twistupper
715
			local limbcollider = Instance.new("Part", limb)
716
			limbcollider.Size = Vector3.new(0.1,1,1)
717
			limbcollider.Shape = "Cylinder"
718
			limbcollider.Transparency = 1
719
			limbcollider:BreakJoints()
720
			local limbcolliderweld = Instance.new("Weld", limbcollider)
721
			limbcolliderweld.Part0 = limb
722
			limbcolliderweld.Part1 = limbcollider
723
			limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
724
		end
725
		local function makehingeconnections(limb, attachementone, attachmenttwo, lower, upper)
726
			local connection = Instance.new('HingeConstraint', limb)
727
			connection.LimitsEnabled = true
728
			connection.Attachment0 = attachementone
729
			connection.Attachment1 = attachmenttwo
730
			connection.LimitsEnabled = true
731
			connection.LowerAngle = lower
732
			connection.UpperAngle = upper
733
			local limbcollider = Instance.new("Part", limb)
734
			limbcollider.Size = Vector3.new(0.1,1,1)
735
			limbcollider.Shape = "Cylinder"
736
			limbcollider.Transparency = 1
737
			limbcollider:BreakJoints()
738
			local limbcolliderweld = Instance.new("Weld", limbcollider)
739
			limbcolliderweld.Part0 = limb
740
			limbcolliderweld.Part1 = limbcollider
741
			limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
742
		end
743
		local HeadAttachment = Instance.new("Attachment", Humanoid.Parent.Head)
744
		HeadAttachment.Position = Vector3.new(0, -0.5, 0)
745
		if ragdoll.UpperTorso:findFirstChild("NeckAttachment") then
746
			makehingeconnections(Humanoid.Parent.Head, HeadAttachment, ragdoll.UpperTorso.NeckAttachment, -50, 50)
747
		end
748
		makehingeconnections(Humanoid.Parent.LowerTorso, Humanoid.Parent.LowerTorso.WaistRigAttachment, Humanoid.Parent.UpperTorso.WaistRigAttachment, -50, 50)
749
		makeballconnections(Humanoid.Parent.LeftUpperArm, Humanoid.Parent.LeftUpperArm.LeftShoulderRigAttachment, Humanoid.Parent.UpperTorso.LeftShoulderRigAttachment, -200, 200, 180)
750
		makehingeconnections(Humanoid.Parent.LeftLowerArm, Humanoid.Parent.LeftLowerArm.LeftElbowRigAttachment, Humanoid.Parent.LeftUpperArm.LeftElbowRigAttachment, 0, -60)
751
		makehingeconnections(Humanoid.Parent.LeftHand, Humanoid.Parent.LeftHand.LeftWristRigAttachment, Humanoid.Parent.LeftLowerArm.LeftWristRigAttachment, -20, 20)
752
		--
753
		makeballconnections(Humanoid.Parent.RightUpperArm, Humanoid.Parent.RightUpperArm.RightShoulderRigAttachment, Humanoid.Parent.UpperTorso.RightShoulderRigAttachment, -200, 200, 180)
754
		makehingeconnections(Humanoid.Parent.RightLowerArm, Humanoid.Parent.RightLowerArm.RightElbowRigAttachment, Humanoid.Parent.RightUpperArm.RightElbowRigAttachment, 0, -60)
755
		makehingeconnections(Humanoid.Parent.RightHand, Humanoid.Parent.RightHand.RightWristRigAttachment, Humanoid.Parent.RightLowerArm.RightWristRigAttachment, -20, 20)
756
		--
757
		makeballconnections(Humanoid.Parent.RightUpperLeg, Humanoid.Parent.RightUpperLeg.RightHipRigAttachment, Humanoid.Parent.LowerTorso.RightHipRigAttachment, -80, 80, 80)
758
		makehingeconnections(Humanoid.Parent.RightLowerLeg, Humanoid.Parent.RightLowerLeg.RightKneeRigAttachment, Humanoid.Parent.RightUpperLeg.RightKneeRigAttachment, 0, 60)
759
		makehingeconnections(Humanoid.Parent.RightFoot, Humanoid.Parent.RightFoot.RightAnkleRigAttachment, Humanoid.Parent.RightLowerLeg.RightAnkleRigAttachment, -20, 20)
760
		--
761
		makeballconnections(Humanoid.Parent.LeftUpperLeg, Humanoid.Parent.LeftUpperLeg.LeftHipRigAttachment, Humanoid.Parent.LowerTorso.LeftHipRigAttachment, -80, 80, 80)
762
		makehingeconnections(Humanoid.Parent.LeftLowerLeg, Humanoid.Parent.LeftLowerLeg.LeftKneeRigAttachment, Humanoid.Parent.LeftUpperLeg.LeftKneeRigAttachment, 0, 60)
763
		makehingeconnections(Humanoid.Parent.LeftFoot, Humanoid.Parent.LeftFoot.LeftAnkleRigAttachment, Humanoid.Parent.LeftLowerLeg.LeftAnkleRigAttachment, -20, 20)
764
		for i,v in pairs(Humanoid.Parent:GetChildren()) do
765
			if v.ClassName == "Accessory" then
766
				local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
767
				if attachment1 then
768
					for q,w in pairs(Humanoid.Parent:GetChildren()) do
769
						if w.ClassName == "Part" then
770
							local attachment2 = w:findFirstChild(attachment1.Name)
771
							if attachment2 then
772
								local hinge = Instance.new("HingeConstraint", v.Handle)
773
								hinge.Attachment0 = attachment1
774
								hinge.Attachment1 = attachment2
775
								hinge.LimitsEnabled = true
776
								hinge.LowerAngle = 0
777
								hinge.UpperAngle = 0
778
							end
779
						end
780
					end
781
				end
782
			end
783
		end
784
		for i,v in pairs(ragdoll:GetChildren()) do
785
			for q,w in pairs(v:GetChildren()) do
786
				if w.ClassName == "Motor6D"--[[ and w.Name ~= "Neck"--]] then
787
					w:destroy()
788
				end
789
			end
790
		end
791
		if ragdoll:findFirstChild("HumanoidRootPart") then
792
			ragdoll.HumanoidRootPart.Anchored = true
793
			ragdoll.HumanoidRootPart.CanCollide = false
794
		end
795
		if ragdoll:findFirstChildOfClass("Humanoid") then
796
			ragdoll:findFirstChildOfClass("Humanoid").PlatformStand = true
797
		end
798
		local function waitfordatmoment()
799
			wait(0.2)
800
			local function searchforvelocity(wot)
801
				for i,v in pairs(wot:GetChildren()) do
802
					searchforvelocity(v)
803
					if v.ClassName == "BodyPosition" or v.ClassName == "BodyVelocity" then
804
						v:destroy()
805
					end
806
				end
807
			end
808
			searchforvelocity(ragdoll)
809
		end
810
		spawn(waitfordatmoment)
811
		game.Debris:AddItem(ragdoll, 30)
812
	end
813
end