View difference between Paste ID: PRGdPRqN and n01WhFtx
SHOW: | | - or go back to the newest paste.
1
--AK47 by Protofer_S
2
local Players = game:GetService("Players")
3
local Player = owner
4
local Tool = Instance.new("Tool") Tool.Name='AK47' Tool.CanBeDropped=false
5
local Handle = Instance.new("Part",Tool) Handle.Size=Vector3.new(0.5, 0.99, 0.341) Handle.Name='Handle'
6
local mesh = Instance.new("SpecialMesh",Handle) mesh.MeshId='rbxassetid://3824749' mesh.TextureId='rbxassetid://159740858' mesh.Scale=Vector3.new(2, 1.3, 1.1)
7
Tool.GripForward=Vector3.new(0, 0, -1) Tool.GripPos=Vector3.new(0, -0.2, 0.8) Tool.GripRight=Vector3.new(1, 0, 0) Tool.GripUp=Vector3.new(0, 1, 0)
8
9
Tool.Parent=Player.Backpack
10
tool = Tool
11
local player = nil
12
local remote = Instance.new("RemoteEvent",tool) remote.Name='hit'
13
local pos = Vector3.new(0,0,0)
14
local enabled=true
15
local hitshot = Handle.CFrame
16
script.Parent=Tool
17
local run = game:GetService("RunService")
18
local message
19
local shooting
20
21
22
function mouse()
23
	NLS([[local Tool = script.Parent
24
local Player = game:GetService("Players").LocalPlayer
25
local remote = Tool:WaitForChild('hit',5)
26
local mouse = Player:GetMouse()
27
local run = game:GetService("RunService")
28
local shooting=false
29
local enabled=false
30
31
Tool.Equipped:Connect(function()
32
enabled=true
33
end)
34
35
Tool.Unequipped:Connect(function()
36
enabled=false
37
end)
38
39
mouse.Button1Down:connect(function(the)
40
41
	shooting=true
42
43
end)
44
45
mouse.Button1Up:connect(function(the)
46
47
	shooting=false
48
49
end)
50
51
52
53
run.RenderStepped:Connect(function()
54
	if shooting==true then
55
     if enabled==true then
56
			remote:FireServer(mouse.Hit.p,true)
57
		else
58
			remote:FireServer(mouse.Hit.p,false)
59
		end
60
	else
61
		remote:FireServer(mouse.Hit.p,false)
62
    end
63
end)
64
65
66
]],tool)
67
end
68
69
70
function effect(vict)
71
	local headcf = vict
72
	for i = 1,5 do
73
		local bshpere2 = Instance.new("WedgePart",nil)
74
		bshpere2.Size = Vector3.new(math.random(2,6),math.random(2,6),0.03)
75
		bshpere2.Transparency = 1
76
		bshpere2.CanCollide = false
77
		bshpere2.Anchored = true
78
		local decal = Instance.new("Decal",bshpere2)
79
		decal.Texture = "rbxassetid://122022304"
80
		local decal2 = Instance.new("Decal",bshpere2)
81
		--decal2.Texture = "rbxassetid://122022304"
82
		--decal2.Face = Enum.NormalId.Back
83
		local dir = Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100)).Unit * 20
84
		local ray = Ray.new(headcf.Position,dir)
85
		local part,pos,normal = workspace:FindPartOnRay(ray,script.Parent,false,true)
86
		if part ~= nil then
87
			bshpere2.CFrame = CFrame.new(pos,pos + normal)
88
			bshpere2.Parent = workspace
89
		end
90
		game:GetService("Debris"):AddItem(bshpere2,10)
91
	end
92
end
93
94
function effect2(death)
95
	local BloodCount = 0 
96
	local tor = death
97
	local MaxBlood = 10
98
	run.Heartbeat:Connect(function()
99
		if BloodCount < MaxBlood then
100
			BloodCount = BloodCount +1
101
			local blood1 = Instance.new("WedgePart")
102
			blood1.Color = Color3.new(0.666667, 0, 0)
103
			blood1.formFactor = 2
104
			blood1.Material=Enum.Material.Glass
105
			blood1.Transparency=.5
106
			blood1.Size = Vector3.new(0.3, 0.3, 0.3)
107
			blood1.BottomSurface = 1
108
			blood1.TopSurface = 1
109
			blood1.CFrame = tor.CFrame * CFrame.new(0,1,0)
110
			blood1.Name = "Blood"
111
			blood1.Parent = workspace
112
			--local Script1 = script.Script:clone()
113
			--Script1.Disabled = false
114
			--Script1.Parent = blood1
115
			local WaitTime = 1
116
			game:GetService("Debris"):AddItem(blood1,10)
117
			if WaitTime == 1 then
118
				wait()
119
			end
120
		end
121
		if BloodCount == MaxBlood then
122
			return end
123
	end)
124
end
125
126
Tool.Equipped:Connect(function()
127
	wait()
128
	Player = Players:GetPlayerFromCharacter(Tool.Parent)
129
	enabled=true
130
end)
131
132
Tool.Unequipped:Connect(function()
133
	enabled=false
134
end)
135
136
mouse()
137
138
function killhumanoid(hum)
139
	coroutine.resume(coroutine.create(function()
140
		while true do wait()
141
			if hum:IsDescendantOf(workspace) then
142
				hum.Health=0
143
			else
144
				break
145
			end
146
		end
147
	end))
148
149
end
150
151
remote.OnServerEvent:Connect(function(m,mess,shot)
152
	message=mess shooting=shot
153
end)
154
function bullet()
155
	coroutine.resume(coroutine.create(function()
156
		pcall(function()
157
			local pos = Handle.CFrame * CFrame.new(.1,.55,0)
158
			local bull = Instance.new("SpawnLocation") bull.CanCollide=false bull.Enabled=false bull.Neutral=false  bull.Massless=true bull.Color=Color3.new(1, 0.666667, 0) bull.Parent=tool bull.Size=Vector3.new(.3,.2,.2) bull.Name='Shell'
159
			local M = Instance.new("SpecialMesh",bull) M.MeshId='rbxassetid://7191976822' M.Scale=Vector3.new(0.45, 0.65, 0.65)
160
			bull.CFrame=pos*CFrame.Angles(0,math.rad(-90),0)
161
			bull.Velocity = Vector3.new(math.random(0,3)*3,math.random(-1,1)*3,math.random(-2,2)*3)
162
			wait(1)
163
			bull:Destroy()
164
		end)
165
	end))
166
end
167
168
run.Heartbeat:Connect(function()
169
	if shooting==true then
170
		local Humanoid = Player.Character:FindFirstChildOfClass('Humanoid')
171
		if Humanoid then
172
			pos=message
173
			if enabled==true then
174
				enabled=false
175
				local shot = Handle:FindFirstChild('shot') if shot then
176
					shot.TimePosition=.1
177
					shot.Volume=math.random(2,5)
178
					shot:Play()
179
				else
180
					shot = Instance.new("Sound",Handle) shot.TimePosition=.1 shot.SoundId='rbxassetid://6154490497' shot.Name='shot' shot.Volume=2 shot:Play()
181
				end
182
183
				hitshot = Handle.CFrame * CFrame.new(0,.39,-2)
184
				if Humanoid.Health > 0 then
185
					local ray = Ray.new(hitshot.p, (pos - hitshot.p).unit * 600)
186
					local part, position = workspace:FindPartOnRay(ray, Player.Character, false, true)
187
					local beam = Instance.new("WedgePart", workspace)
188
					beam.BrickColor =  BrickColor.new("Cool yellow")--player.TeamColor
189
					beam.Material = Enum.Material.Neon
190
					beam.Transparency = .3
191
					beam.Anchored = true
192
					beam.Locked = true
193
					beam.CanCollide = false
194
					bullet()
195
					local distance = (hitshot.p - position).magnitude
196
					beam.Size = Vector3.new(.05, .05, distance)
197
					beam.CFrame = CFrame.new(hitshot.p, position)*CFrame.new(0, 0, -distance / 2)
198
199
					game:GetService("Debris"):AddItem(beam,0.1)
200
201
					if part then
202
203
						if part.Name=='Handle' then
204
							part.Anchored=false
205
							part:BreakJoints() 
206
							part.Velocity = Vector3.new(math.random(-5,5)*10,math.random(-5,5)*10,math.random(-5,5)*10)
207
							part.CanCollide=false
208
						end
209
						local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
210
						if not humanoid then
211
							humanoid = part.Parent.Parent:FindFirstChildOfClass("Humanoid")
212
						end
213
214
						if humanoid then
215-
							if humanoid.Health>99 then humanoid.Health=0 killhumanoid(humanoid)
215+
							if humanoid.Health>9e9 then humanoid.Health=0 killhumanoid(humanoid)
216
								for i,v in pairs(part.Parent:GetDescendants()) do
217
									if v:IsA("Constraint") or v:IsA("Attachment") or v:IsA("Weld") then v:Destroy()end
218
									if v:IsA("BasePart") or v:IsA("FlagStand") then 
219
										v.Anchored=false
220
										v:BreakJoints()
221
									end
222
								end
223
							else
224-
								humanoid.Health=humanoid.Health-math.random(9,40)
224+
								humanoid.Health=humanoid.Health-math.random(9,20)
225
							end
226
						end
227
						if part.Name=='Head' then
228
							effect2(part)
229
							local gore = Instance.new("Sound",part) gore.SoundId='rbxassetid://429400881'  gore.Volume=.7 gore.PlayOnRemove=true gore:Play()
230
							part:BreakJoints()  part.Color=Color3.new(0.666667, 0, 0) --part.Name='dead'
231
							for i,v in pairs(part.Parent:GetDescendants()) do
232
								if v:IsA("BasePart") then 
233
									v.Anchored=false
234
									v:BreakJoints()
235
									if v.Name=='Torso' then
236
237
									end
238
								end
239
							end
240
241
						--[[
242
						if humanoid then
243
							if humanoid.Health>0.1 then
244
							end
245
						end
246
                    	effect(part)
247
						]]
248
249
							local ded = part:FindFirstChildOfClass('Decal')  
250
							if ded then
251
								ded.Texture='http://www.roblox.com/asset/?id=860143307'
252
							else
253
								ded = Instance.new("Decal",ded) ded.Texture='http://www.roblox.com/asset/?id=860143307'
254
							end
255
					--[[
256
					local effect = Instance.new("ParticleEmitter",part) 
257
					effect.Color=ColorSequence.new(Color3.new(0.666667, 0, 0)) 
258
					effect.Size=NumberSequence.new(0,0.7) effect.Texture='http://www.roblox.com/asset/?id=243457340' effect.Orientation=Enum.ParticleOrientation.FacingCamera effect.Acceleration=Vector3.new(0,-1.5,0)
259
					effect.Lifetime=NumberRange.new(1,2)
260
					effect.EmissionDirection=Enum.NormalId.Bottom 	effect.Enabled=true effect.Rate=100	effect.Speed=NumberRange.new(4, 4)	effect.SpreadAngle=Vector2.new(10,10)
261
				
262
					wait(.5)
263
					effect:Destroy()
264
					]]
265
							wait()
266
							part:Destroy()
267
						end
268
					end
269
270
271
272
				end
273
				wait(.04)
274
				enabled=true
275
			end
276
		end
277
	end
278
end)
279