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