View difference between Paste ID: 6rDmx3XQ and uZmqDzRg
SHOW: | | - or go back to the newest paste.
1
print("EDIT BY xMTSxClyde")
2
function snapToTorso(pos)
3
	local list = game.Workspace:children()
4
	local torso = nil
5
	local dist = 100
6
	local temp = nil
7
	local human = nil
8
	local temp2 = nil
9
	for x = 1, #list do
10
		temp2 = list[x]
11
		if (temp2.className == "Model") and (temp2 ~= script.Parent) then
12
			temp = temp2:findFirstChild("Torso")
13
			human = temp2:findFirstChild("Humanoid")
14
			if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
15
				if (temp.Position - pos).magnitude < dist then
16
					torso = temp
17
					dist = (temp.Position - pos).magnitude
18
					annihilate()
19
				end
20
			end
21
		end
22
	end
23
	return torso
24
end
25
26
function annihilate(gun,targ)
27
pcall(function() p:remove() end)
28-
p.BrickColor = BrickColor.new(21)
28+
29
p.BrickColor = BrickColor.new(45)
30
p.Anchored = true
31
p.CanCollide = false
32
p.formFactor = "Plate"
33
p.Size = Vector3.new(1,0.4,1)
34
p.TopSurface = "Smooth"
35
p.BottomSurface = "Smooth"
36
local sm = Instance.new("SpecialMesh")
37
sm.MeshType = "Sphere"
38
sm.Parent = p
39
local mag = (gun.Position - targ).magnitude
40
local aim = CFrame.new(gun.Position,targ)
41
p.CFrame = aim + (aim.lookVector * (mag / 2))
42
sm.Scale = Vector3.new(0.2,0.2,mag )
43
p.Parent = workspace
44
coroutine.resume(coroutine.create(function()
45
wait(0.3)
46
pcall(function() p:remove() end)
47
end))
48
end
49
laser(script.Parent.Shooter,torso)
50
local ex = Instance.new("Explosion")
51-
ex.BlastRadius = 3
51+
52
ex.BlastRadius = 999999
53
ex.Parent = workspace
54-
end)
54+
55
end)
56
<eof>