View difference between Paste ID: qnyVA3h0 and uycY2yBk
SHOW: | | - or go back to the newest paste.
1-
local runDummyScript = function(f,scri)
1+
--https://github.com/Mokiros/roblox-FE-compatibility
2
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
3
local Player,game,owner = owner,game
4
local RealPlayer = Player
5
do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end local runDummyScript = function(f,scri)
6
local oldenv = getfenv(f)
7
local newenv = setmetatable({}, {
8
__index = function(_, k)
9
if k:lower() == 'script' then
10
return scri
11
else
12
return oldenv[k]
13
end
14
end
15
})
16
setfenv(f, newenv)
17
ypcall(function() f() end)
18
end
19
cors = {}
20
mas = Instance.new("Model",game:GetService("Lighting")) 
21
mas.Name = "CompiledModel"
22
o1 = Instance.new("Tool")
23
o2 = Instance.new("Part")
24
o3 = Instance.new("SpecialMesh")
25
o4 = Instance.new("Sound")
26
o5 = Instance.new("Sound")
27
o6 = Instance.new("Sound")
28
o7 = Instance.new("Sound")
29
o8 = Instance.new("PointLight")
30
o9 = Instance.new("Sound")
31
o11 = Instance.new("Animation")
32
o12 = Instance.new("ScreenGui")
33
o13 = Instance.new("Frame")
34
o14 = Instance.new("TextLabel")
35
o15 = Instance.new("TextLabel")
36
o16 = Instance.new("TextLabel")
37
o17 = Instance.new("Frame")
38
o18 = Instance.new("Frame")
39
o19 = Instance.new("Frame")
40
o20 = Instance.new("Frame")
41
o21 = Instance.new("ImageLabel")
42
o22 = Instance.new("TextLabel")
43
o23 = Instance.new("Frame")
44
o24 = Instance.new("Frame")
45
o25 = Instance.new("TextLabel")
46
o26 = Instance.new("LocalScript")
47
o27 = Instance.new("LocalScript")
48
o28 = Instance.new("LocalScript")
49
o29 = Instance.new("Part")
50
o30 = Instance.new("SpecialMesh")
51
o31 = Instance.new("Part")
52
o32 = Instance.new("SpecialMesh")
53
o33 = Instance.new("Part")
54
o34 = Instance.new("SpecialMesh")
55
o35 = Instance.new("Part")
56
o36 = Instance.new("SpecialMesh")
57
o37 = Instance.new("Part")
58
o38 = Instance.new("CylinderMesh")
59
o39 = Instance.new("Script")
60
o1.Name = "M870"
61
o1.Parent = mas
62
o1.TextureId = "http://www.roblox.com/asset/?id=122079958"
63
o1.GripForward = Vector3.new(-0.242524415, 0.970096886, -0.00969904661)
64
o1.GripPos = Vector3.new(0.25999999, -0.600000024, -0.330000013)
65
o1.GripRight = Vector3.new(0.970145285, 0.242512301, -0.00242490321)
66
o1.GripUp = Vector3.new(2.23517418e-007, 0.00999760628, 0.999950111)
67
o1.ToolTip = "Ithaca 37"
68
o1.CanBeDropped = false
69
o2.Name = "Handle"
70
o2.Parent = o1
71
o2.BrickColor = BrickColor.new("Black")
72
o2.Position = Vector3.new(-72.2855453, 0.500015974, -32.7285843)
73
o2.Rotation = Vector3.new(-90, 0, -90)
74
o2.FormFactor = Enum.FormFactor.Custom
75
o2.Size = Vector3.new(0.200000003, 2.79999995, 1)
76
o2.CFrame = CFrame.new(-72.2855453, 0.500015974, -32.7285843, 0, 1, 0, 0, 0, 1, 1, 0, 0)
77
o2.BottomSurface = Enum.SurfaceType.Smooth
78
o2.TopSurface = Enum.SurfaceType.Smooth
79
o2.Color = Color3.new(0.105882, 0.164706, 0.207843)
80
o2.Position = Vector3.new(-72.2855453, 0.500015974, -32.7285843)
81
o3.Parent = o2
82
o3.MeshId = "http://www.roblox.com/asset/?id=71947462"
83
o3.Scale = Vector3.new(1.20000005, 1, 1.20000005)
84
o3.TextureId = "http://www.roblox.com/asset/?id=71947415"
85
o3.MeshType = Enum.MeshType.FileMesh
86
o4.Name = "FireSound"
87
o4.Parent = o2
88
o4.Pitch = 0.94999998807907
89
o4.SoundId = "http://roblox.com/asset/?id=130780450 "
90
o4.Volume = 1
91
o5.Name = "PumpSound"
92
o5.Parent = o2
93
o5.Pitch = 0.80000001192093
94
o5.SoundId = "http://www.roblox.com/asset/?id=10209881"
95
o5.Volume = 1
96
o6.Name = "Reload"
97
o6.Parent = o2
98
o6.SoundId = "http://roblox.com/asset/?id=10209845 "
99
o6.Volume = 1
100
o7.Name = "EquipSound"
101
o7.Parent = o2
102
o7.SoundId = "http://www.roblox.com/asset/?id=10209881"
103
o7.Volume = 1
104
o8.Name = "Flash"
105
o8.Parent = o2
106
o8.Color = Color3.new(1, 1, 0)
107
o8.Enabled = false
108
o8.Brightness = 1.5
109
o9.Name = "Tick"
110
o9.Parent = o2
111
o9.SoundId = "rbxasset://sounds//clickfast.wav"
112
o9.Volume = 1
113
o11.Name = "Recoil"
114
o11.Parent = o1
115
o11.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
116
o12.Name = "WeaponHud"
117
o12.Parent = o1
118
o13.Name = "AmmoHud"
119
o13.Parent = o12
120
o13.Position = UDim2.new(1,-265,1,-60)
121
o13.Size = UDim2.new(0,200,0,50)
122
o13.Style = Enum.FrameStyle.RobloxSquare
123
o13.Position = UDim2.new(1,-265,1,-60)
124
o13.BackgroundTransparency = 1
125
o13.BorderSizePixel = 0
126
o14.Name = "ForwardSlash"
127
o14.Parent = o13
128
o14.Position = UDim2.new(0.5,0,0.5,0)
129
o14.Text = "/"
130
o14.Position = UDim2.new(0.5,0,0.5,0)
131
o14.BackgroundTransparency = 1
132
o14.BorderSizePixel = 0
133
o14.FontSize = Enum.FontSize.Size24
134
o14.TextColor3 = Color3.new(1, 1, 1)
135
o14.TextStrokeTransparency = 0
136
o15.Name = "ClipAmmo"
137
o15.Parent = o13
138
o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
139
o15.Text = "54"
140
o15.Position = UDim2.new(0.44999998807907,0,0.5,0)
141
o15.BackgroundTransparency = 1
142
o15.BorderSizePixel = 0
143
o15.FontSize = Enum.FontSize.Size24
144
o15.TextColor3 = Color3.new(1, 1, 1)
145
o15.TextStrokeTransparency = 0
146
o15.TextXAlignment = Enum.TextXAlignment.Right
147
o16.Name = "TotalAmmo"
148
o16.Parent = o13
149
o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
150
o16.Text = "180"
151
o16.Position = UDim2.new(0.55000001192093,0,0.5,0)
152
o16.BackgroundTransparency = 1
153
o16.BorderSizePixel = 0
154
o16.FontSize = Enum.FontSize.Size24
155
o16.TextColor3 = Color3.new(1, 1, 1)
156
o16.TextStrokeTransparency = 0
157
o16.TextXAlignment = Enum.TextXAlignment.Left
158
o17.Name = "Crosshair"
159
o17.Parent = o12
160
o17.Position = UDim2.new(0,500,0,500)
161
o17.Size = UDim2.new(0,150,0,150)
162
o17.Position = UDim2.new(0,500,0,500)
163
o17.BackgroundColor3 = Color3.new(0, 1, 0)
164
o17.BackgroundTransparency = 1
165
o17.BorderSizePixel = 0
166
o18.Name = "TopFrame"
167
o18.Parent = o17
168
o18.Position = UDim2.new(0,-1,-0.5,-7)
169
o18.Size = UDim2.new(0,2,0,14)
170
o18.Position = UDim2.new(0,-1,-0.5,-7)
171
o18.BackgroundColor3 = Color3.new(1, 1, 1)
172
o18.BorderColor3 = Color3.new(0, 0, 0)
173
o19.Name = "RightFrame"
174
o19.Parent = o17
175
o19.Position = UDim2.new(0.5,-7,0,-1)
176
o19.Size = UDim2.new(0,14,0,2)
177
o19.Position = UDim2.new(0.5,-7,0,-1)
178
o19.BackgroundColor3 = Color3.new(1, 1, 1)
179
o19.BorderColor3 = Color3.new(0, 0, 0)
180
o20.Name = "LeftFrame"
181
o20.Parent = o17
182
o20.Position = UDim2.new(-0.5,-7,0,-1)
183
o20.Size = UDim2.new(0,14,0,2)
184
o20.Position = UDim2.new(-0.5,-7,0,-1)
185
o20.BackgroundColor3 = Color3.new(1, 1, 1)
186
o20.BorderColor3 = Color3.new(0, 0, 0)
187
o21.Name = "TargetHitImage"
188
o21.Parent = o17
189
o21.Position = UDim2.new(0,-25,0,-25)
190
o21.Size = UDim2.new(0,50,0,50)
191
o21.Position = UDim2.new(0,-25,0,-25)
192
o21.Visible = false
193
o21.BackgroundTransparency = 1
194
o21.BorderSizePixel = 0
195
o21.Image = "http://www.roblox.com/asset/?id=115400215"
196
o22.Name = "ReloadingLabel"
197
o22.Parent = o17
198
o22.Position = UDim2.new(0,20,0,-20)
199
o22.Text = "Reloading"
200
o22.Position = UDim2.new(0,20,0,-20)
201
o22.Visible = false
202
o22.BackgroundTransparency = 1
203
o22.BorderSizePixel = 0
204
o22.Font = Enum.Font.ArialBold
205
o22.FontSize = Enum.FontSize.Size18
206
o22.TextColor3 = Color3.new(1, 1, 1)
207
o22.TextStrokeTransparency = 0
208
o22.TextXAlignment = Enum.TextXAlignment.Left
209
o22.TextYAlignment = Enum.TextYAlignment.Bottom
210
o23.Name = "BottomFrame"
211
o23.Parent = o17
212
o23.Position = UDim2.new(0,-1,0.5,-7)
213
o23.Size = UDim2.new(0,2,0,14)
214
o23.Position = UDim2.new(0,-1,0.5,-7)
215
o23.BackgroundColor3 = Color3.new(1, 1, 1)
216
o23.BorderColor3 = Color3.new(0, 0, 0)
217
o24.Name = "Reload"
218
o24.Parent = o12
219
o24.Position = UDim2.new(1,-265,1,-120)
220
o24.Size = UDim2.new(0,200,0,50)
221
o24.Position = UDim2.new(1,-265,1,-120)
222
o24.Visible = false
223
o24.BackgroundTransparency = 1
224
o24.BorderSizePixel = 0
225
o25.Name = "Reload"
226
o25.Parent = o24
227
o25.Position = UDim2.new(0.5,0,0.5,0)
228
o25.Text = "Press R to Reload"
229
o25.Position = UDim2.new(0.5,0,0.5,0)
230
o25.BackgroundTransparency = 1
231
o25.BorderSizePixel = 0
232
o25.Font = Enum.Font.ArialBold
233
o25.FontSize = Enum.FontSize.Size24
234
o25.TextColor3 = Color3.new(1, 0, 0)
235
o25.TextStrokeTransparency = 0
236
o26.Name = "Ithaca"
237
o26.Parent = o1
238
table.insert(cors,coroutine.create(function()
239
wait()
240
runDummyScript(function()
241
--------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
242
-- Waits for the child of the specified parent
243
local function WaitForChild(parent, childName)
244
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
245
	return parent[childName]
246
end
247
248
----- MAGIC NUMBERS ABOUT THE TOOL -----
249
-- How much damage a bullet does
250
local Damage = 70
251
-- How many times per second the gun can fire
252
local FireRate = 1 / 1.33
253
-- The maximum distance the can can shoot, this value should never go above 1000
254
local Range = 200
255
-- In radians the minimum accuracy penalty
256
local MinSpread = 0.05
257
-- In radian the maximum accuracy penalty
258
local MaxSpread = 0.1
259
-- Number of bullets in a clip
260
local ClipSize = 6
261
-- DefaultValue for spare ammo
262
local SpareAmmo = 300
263
-- The amount the aim will increase or decrease by
264
-- decreases this number reduces the speed that recoil takes effect
265
local AimInaccuracyStepAmount = 0.0133
266
-- Time it takes to reload weapon
267
local ReloadTime = 4
268
----------------------------------------
269
270
-- Colors
271
local FriendlyReticleColor = Color3.new(0, 1, 0)
272
local EnemyReticleColor	= Color3.new(1, 0, 0)
273
local NeutralReticleColor	= Color3.new(1, 1, 1)
274
275
local Spread = MinSpread
276
local AmmoInClip = ClipSize
277
278
local Tool = script.Parent
279
local Handle = WaitForChild(Tool, 'Handle')
280
local WeaponGui = nil
281
282
local LeftButtonDown
283
local Reloading = false
284
local IsShooting = false
285
286
-- Player specific convenience variables
287
local MyPlayer = nil
288
local MyCharacter = nil
289
local MyHumanoid = nil
290
local MyTorso = nil
291
local MyMouse = nil
292
293
local RecoilAnim
294
local RecoilTrack = nil
295
296
local IconURL = Tool.TextureId  -- URL to the weapon icon asset
297
298
local DebrisService = game:GetService('Debris')
299
local PlayersService = game:GetService('Players')
300
301
302
local FireSound
303
304
local OnFireConnection = nil
305
local OnReloadConnection = nil
306
307
local DecreasedAimLastShot = false
308
local LastSpreadUpdate = time()
309
310
-- this is a dummy object that holds the flash made when the gun is fired
311
local FlashHolder = nil
312
313
314
local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
315
local GetCellFunction = Workspace.Terrain.GetCell
316
317
function RayIgnoreCheck(hit, pos)
318
	if hit then
319
		if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
320
				hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
321
				hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
322
			return true
323
		elseif hit:IsA('Terrain') and pos then
324
			local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
325
			if cellPos then
326
				local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
327
				if cellMat and cellMat == Enum.CellMaterial.Water then
328
					return true
329
				end
330
			end
331
		end
332
	end
333
	return false
334
end
335
336
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
337
function RayCast(startPos, vec, rayLength)
338
	local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
339
	if hitObject and hitPos then
340
		local distance = rayLength - (hitPos - startPos).magnitude
341
		if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
342
			-- there is a chance here for potential infinite recursion
343
			return RayCast(hitPos, vec, distance)
344
		end
345
	end
346
	return hitObject, hitPos
347
end
348
349
350
351
function TagHumanoid(humanoid, player)
352
	-- Add more tags here to customize what tags are available.
353
	while humanoid:FindFirstChild('creator') do
354
		humanoid:FindFirstChild('creator'):Destroy()
355
	end 
356
	local creatorTag = Instance.new("ObjectValue")
357
	creatorTag.Value = player
358
	creatorTag.Name = "creator"
359
	creatorTag.Parent = humanoid
360
	DebrisService:AddItem(creatorTag, 1.5)
361
362
	local weaponIconTag = Instance.new("StringValue")
363
	weaponIconTag.Value = IconURL
364
	weaponIconTag.Name = "icon"
365
	weaponIconTag.Parent = creatorTag
366
end
367
368
369
local function CreateBullet(bulletPos)
370
	local bullet = Instance.new('Part', Workspace)
371
	bullet.FormFactor = Enum.FormFactor.Custom
372
	bullet.Size = Vector3.new(0.1, 0.1, 0.1)
373
	bullet.BrickColor = BrickColor.new("Black")
374
	bullet.Shape = Enum.PartType.Block
375
	bullet.CanCollide = false
376
	bullet.CFrame = CFrame.new(bulletPos)
377
	bullet.Anchored = true
378
	bullet.TopSurface = Enum.SurfaceType.Smooth
379
	bullet.BottomSurface = Enum.SurfaceType.Smooth
380
	bullet.Name = 'Bullet'
381
	DebrisService:AddItem(bullet, 2.5)
382
	return bullet
383
end
384
385
local function Reload()
386
	if not Reloading then
387
		Reloading = true
388
		-- Don't reload if you are already full or have no extra ammo
389
		if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
390
			if RecoilTrack then
391
				RecoilTrack:Stop()
392
			end
393
			if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
394
				if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
395
					WeaponGui.Crosshair.ReloadingLabel.Visible = true
396
				end
397
			end
398
			script.Parent.Handle.Reload:Play()
399
			wait(.75)
400
			script.Parent.Handle.Reload:Play()
401
			wait(.75)
402
			script.Parent.Handle.Reload:Play()
403
			wait(.75)
404
			script.Parent.Handle.Reload:Play()
405
			wait(.75)
406
			script.Parent.Handle.PumpSound:Play()
407
			-- Only use as much ammo as you have
408
			local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
409
			AmmoInClip = AmmoInClip + ammoToUse
410
			SpareAmmo = SpareAmmo - ammoToUse
411
			UpdateAmmo(AmmoInClip)
412
			WeaponGui.Reload.Visible = false
413
		end
414
		Reloading = false
415
	end
416
end
417
418
function OnFire()
419
	if IsShooting then return end
420
	if MyHumanoid and MyHumanoid.Health > 0 then
421
		if RecoilTrack and AmmoInClip > 0 then
422
			RecoilTrack:Play()
423
		end
424
		IsShooting = true
425
		while LeftButtonDown and AmmoInClip > 0 and not Reloading do
426
			if Spread and not DecreasedAimLastShot then
427
				Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
428
				UpdateCrosshair(Spread)
429
			end
430
			DecreasedAimLastShot = not DecreasedAimLastShot
431
			if Handle:FindFirstChild('FireSound') then
432
				Handle.FireSound:Play()
433
				Handle.Flash.Enabled = true
434
			end
435
			if MyMouse then
436
				for i = 1,12 do -- Shotgun effect :P
437
					local targetPoint = MyMouse.Hit.p
438
					local shootDirection = (targetPoint - Handle.Position).unit
439
					-- Adjust the shoot direction randomly off by a little bit to account for recoil
440
					shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
441
																	(0.5 - math.random()) * 2 * Spread,
442
																	(0.5 - math.random()) * 2 * Spread) * shootDirection
443
					local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
444
					local bullet
445
					-- Create a bullet here
446
					if hitObject then
447
						bullet = CreateBullet(bulletPos)
448
					end
449
					if hitObject and hitObject.Parent then
450
						local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
451
						if hitHumanoid then
452
							local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
453
							if MyPlayer.Neutral or hitPlayer then
454
								TagHumanoid(hitHumanoid, MyPlayer)
455
								hitHumanoid:TakeDamage(Damage)
456
								if bullet then
457
									bullet:Destroy()
458
									bullet = nil
459
									--bullet.Transparency = 1
460
								end
461
								Spawn(UpdateTargetHit)
462
							elseif not hitPlayer then
463
								TagHumanoid(hitHumanoid, MyPlayer)
464
								hitHumanoid:TakeDamage(Damage)
465
								if bullet then
466
									bullet:Destroy()
467
									bullet = nil
468
									--bullet.Transparency = 1
469
								end
470
								Spawn(UpdateTargetHit)
471
							end
472
						end
473
					end
474
				end
475
				AmmoInClip = AmmoInClip - 1
476
				UpdateAmmo(AmmoInClip)
477
			end
478
			Handle.PumpSound:Play()
479
			wait(.2); Handle.Flash.Enabled = false
480
			wait(FireRate)
481
			OnMouseUp()
482
		end
483
		IsShooting = false
484
		if AmmoInClip == 0 then
485
			Handle.Tick:Play()
486
			WeaponGui.Reload.Visible = true
487
		end
488
		if RecoilTrack then
489
			RecoilTrack:Stop()
490
		end
491
	end
492
end
493
494
local TargetHits = 0
495
function UpdateTargetHit()
496
	TargetHits = TargetHits + 1
497
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
498
		WeaponGui.Crosshair.TargetHitImage.Visible = true
499
	end
500
	wait(0.5)
501
	TargetHits = TargetHits - 1
502
	if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
503
		WeaponGui.Crosshair.TargetHitImage.Visible = false
504
	end
505
end
506
507
function UpdateCrosshair(value, mouse)
508
	if WeaponGui then
509
		local absoluteY = 650
510
		WeaponGui.Crosshair:TweenSize(
511
			UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
512
			Enum.EasingDirection.Out,
513
			Enum.EasingStyle.Linear,
514
			0.33)
515
	end
516
end
517
518
function UpdateAmmo(value)
519
	if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
520
		WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
521
		if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
522
			WeaponGui.Crosshair.ReloadingLabel.Visible = false
523
		end
524
	end
525
	if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
526
		WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
527
	end
528
end
529
530
531
function OnMouseDown()
532
	LeftButtonDown = true
533
	OnFire()
534
end
535
536
function OnMouseUp()
537
	LeftButtonDown = false
538
end
539
540
function OnKeyDown(key)
541
	if string.lower(key) == 'r' then
542
		Reload()
543
	end
544
end
545
546
547
function OnEquipped(mouse)
548
	Handle.EquipSound:Play()
549
	RecoilAnim = WaitForChild(Tool, 'Recoil')
550
	FireSound  = WaitForChild(Handle, 'FireSound')
551
552
	MyCharacter = Tool.Parent
553
	MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
554
	MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
555
	MyTorso = MyCharacter:FindFirstChild('Torso')
556
	MyMouse = mouse
557
	WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
558
	if WeaponGui and MyPlayer then
559
		WeaponGui.Parent = MyPlayer.PlayerGui
560
		UpdateAmmo(AmmoInClip)
561
	end
562
	if RecoilAnim then
563
		RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
564
	end
565
566
	if MyMouse then
567
		-- Disable mouse icon
568
		MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
569
		MyMouse.Button1Down:connect(OnMouseDown)
570
		MyMouse.Button1Up:connect(OnMouseUp)
571
		MyMouse.KeyDown:connect(OnKeyDown)
572
	end
573
end
574
575
576
-- Unequip logic here
577
function OnUnequipped()
578
	LeftButtonDown = false
579
	Reloading = false
580
	MyCharacter = nil
581
	MyHumanoid = nil
582
	MyTorso = nil
583
	MyPlayer = nil
584
	MyMouse = nil
585
	if OnFireConnection then
586
		OnFireConnection:disconnect()
587
	end
588
	if OnReloadConnection then
589
		OnReloadConnection:disconnect()
590
	end
591
	if FlashHolder then
592
		FlashHolder = nil
593
	end
594
	if WeaponGui then
595
		WeaponGui.Parent = nil
596
		WeaponGui = nil
597
	end
598
	if RecoilTrack then
599
		RecoilTrack:Stop()
600
	end
601
end
602
603
local function SetReticleColor(color)
604
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
605
		for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
606
			if line:IsA('Frame') then
607
				line.BorderColor3 = color
608
			end
609
		end
610
	end
611
end
612
613
614
Tool.Equipped:connect(OnEquipped)
615
Tool.Unequipped:connect(OnUnequipped)
616
617
while true do
618
	wait(0.033)
619
	if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
620
		WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
621
		SetReticleColor(NeutralReticleColor)
622
623
		local target = MyMouse.Target
624
		if target and target.Parent then
625
			local player = PlayersService:GetPlayerFromCharacter(target.Parent)
626
			if player then
627
				if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
628
					SetReticleColor(EnemyReticleColor)
629
				else
630
					SetReticleColor(FriendlyReticleColor)
631
				end
632
			end
633
		end
634
	end
635
	if Spread and not IsShooting then
636
		local currTime = time()
637
		if currTime - LastSpreadUpdate > FireRate * 2 then
638
			LastSpreadUpdate = currTime
639
			Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
640
			UpdateCrosshair(Spread, MyMouse)
641
		end
642
	end
643
end
644
end,o26)
645
end))
646
o27.Name = "ArmWeld [Shotgun]"
647
o27.Parent = o1
648
table.insert(cors,coroutine.create(function()
649
wait()
650
runDummyScript(function()
651
Tool = script.Parent;
652
653
local arms = nil
654
local torso = nil
655
local welds = {}
656
657
function Equip(mouse)
658
wait(0.01)
659
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
660
torso = Tool.Parent:FindFirstChild("Torso")
661
if arms ~= nil and torso ~= nil then
662
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
663
if sh ~= nil then
664
local yes = true
665
if yes then
666
yes = false
667
sh[1].Part1 = nil
668
sh[2].Part1 = nil
669
local weld1 = Instance.new("Weld")
670
weld1.Part0 = torso
671
weld1.Parent = torso
672
weld1.Part1 = arms[1]
673
weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90)) ---The first set of numbers changes where the arms move to the second set changes their angles
674
welds[1] = weld1
675
weld1.Name = "weld1"
676
local weld2 = Instance.new("Weld")
677
weld2.Part0 = torso
678
weld2.Parent = torso
679
weld2.Part1 = arms[2]
680
weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top
681
welds[2] = weld2
682
weld2.Name = "weld2"
683
end
684
else
685
print("sh")
686
end
687
else
688
print("arms")
689
end
690
end
691
692
function Unequip(mouse)
693
if arms ~= nil and torso ~= nil then
694
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
695
if sh ~= nil then
696
local yes = true
697
if yes then
698
yes = false
699
sh[1].Part1 = arms[1]
700
sh[2].Part1 = arms[2]
701
welds[1].Parent = nil
702
welds[2].Parent = nil
703
end
704
else
705
print("sh")
706
end
707
else
708
print("arms")
709
end
710
end
711
Tool.Equipped:connect(Equip)
712
Tool.Unequipped:connect(Unequip)
713
714
end,o27)
715
end))
716
o28.Name = "Patrol [Shotgun]"
717
o28.Parent = o1
718
table.insert(cors,coroutine.create(function()
719
wait()
720
runDummyScript(function()
721
--Note this must be used with the accompanying weld script
722
--This is an edited version of my V3 KeyCommand Script.
723
--Heavily edited from a free model crouch script, ~ukwarrior6~
724
725
----------------------------
726
--Patrol Script--
727
----------------------------
728
729
on = 0
730
Tool = script.Parent
731
welds = {}
732
sh = {}
733
arms = nil
734
torso = nil
735
f = nil
736
Holstered = false
737
wait()
738
local Tool = script.Parent
739
enabled = true
740
----------------------------------------------------------------------------------------------------------------
741
function GunUp()
742
Holstered = false
743
Tool.Enabled = true
744
torso = Tool.Parent:FindFirstChild("Torso")
745
if torso ~= nil then
746
torso.weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90))
747
torso.weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
748
end
749
end
750
751
function GunDown()
752
Holstered = true
753
Tool.Enabled = false -- You don't want to be shooting if your not aiming
754
torso = Tool.Parent:FindFirstChild("Torso")
755
if torso ~= nil then
756
torso.weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(280), math.rad(-10), math.rad(-80))
757
torso.weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-70), math.rad(-25), math.rad(0))
758
end
759
end
760
-----------------------------------------------------------------------------------------------------------------
761
function onEquippedLocal(mouse)
762
   mouse.Icon = "" -- Chuck in a cool crosshair here..
763
	mouse.KeyDown:connect(onKeyDown)
764
end
765
-----------------------------------------------------------------------------------------------------------------
766
function onKeyDown(key)
767
if (key~=nil) then
768
key = key:lower()
769
770
if (key=="e")  then -- Toggle Patrol
771
if Holstered == true then
772
script.Parent.Parent.Humanoid.WalkSpeed = 16
773
GunUp()
774
elseif Holstered == false then
775
script.Parent.Parent.Humanoid.WalkSpeed = 20
776
GunDown()
777
end end end end
778
Tool.Equipped:connect(onEquippedLocal)
779
780
781
782
783
784
785
end,o28)
786
end))
787
o29.Name = "12 Gauge Slugs"
788
o29.Parent = o1
789
o29.BrickColor = BrickColor.new("Medium green")
790
o29.Position = Vector3.new(-73.0601883, 0.659587979, -32.8816261)
791
o29.Rotation = Vector3.new(-90, 2.45901902e-006, 90)
792
o29.Anchored = true
793
o29.FormFactor = Enum.FormFactor.Custom
794
o29.Size = Vector3.new(0.200000003, 0.200000003, 0.550000191)
795
o29.CFrame = CFrame.new(-73.0601883, 0.659587979, -32.8816261, 1.0658141e-014, -1, 4.29179785e-008, 1.44884105e-014, 4.29179714e-008, 1, -1, -4.52982114e-008, -4.37113741e-008)
796
o29.BottomSurface = Enum.SurfaceType.Smooth
797
o29.TopSurface = Enum.SurfaceType.Smooth
798
o29.Color = Color3.new(0.631373, 0.768628, 0.54902)
799
o29.Position = Vector3.new(-73.0601883, 0.659587979, -32.8816261)
800
o30.Parent = o29
801
o30.MeshId = "http://www.roblox.com/asset/?id=94248124"
802
o30.TextureId = "http://www.roblox.com/asset/?id=116456647"
803
o30.MeshType = Enum.MeshType.FileMesh
804
o31.Name = "12 Gauge Slugs"
805
o31.Parent = o1
806
o31.BrickColor = BrickColor.new("Medium green")
807
o31.Position = Vector3.new(-72.7001801, 0.659587979, -32.8816261)
808
o31.Rotation = Vector3.new(-90, 2.45901902e-006, 90)
809
o31.Anchored = true
810
o31.FormFactor = Enum.FormFactor.Custom
811
o31.Size = Vector3.new(0.200000003, 0.200000003, 0.550000191)
812
o31.CFrame = CFrame.new(-72.7001801, 0.659587979, -32.8816261, 1.0658141e-014, -1, 4.29179785e-008, 1.44884105e-014, 4.29179714e-008, 1, -1, -4.52982114e-008, -4.37113741e-008)
813
o31.BottomSurface = Enum.SurfaceType.Smooth
814
o31.TopSurface = Enum.SurfaceType.Smooth
815
o31.Color = Color3.new(0.631373, 0.768628, 0.54902)
816
o31.Position = Vector3.new(-72.7001801, 0.659587979, -32.8816261)
817
o32.Parent = o31
818
o32.MeshId = "http://www.roblox.com/asset/?id=94248124"
819
o32.TextureId = "http://www.roblox.com/asset/?id=116456647"
820
o32.MeshType = Enum.MeshType.FileMesh
821
o33.Name = "12 Gauge Slugs"
822
o33.Parent = o1
823
o33.BrickColor = BrickColor.new("Medium green")
824
o33.Position = Vector3.new(-72.8801727, 0.659587979, -32.8816261)
825
o33.Rotation = Vector3.new(-90, 2.45901902e-006, 90)
826
o33.Anchored = true
827
o33.FormFactor = Enum.FormFactor.Custom
828
o33.Size = Vector3.new(0.200000003, 0.200000003, 0.550000191)
829
o33.CFrame = CFrame.new(-72.8801727, 0.659587979, -32.8816261, 1.0658141e-014, -1, 4.29179785e-008, 1.44884105e-014, 4.29179714e-008, 1, -1, -4.52982114e-008, -4.37113741e-008)
830
o33.BottomSurface = Enum.SurfaceType.Smooth
831
o33.TopSurface = Enum.SurfaceType.Smooth
832
o33.Color = Color3.new(0.631373, 0.768628, 0.54902)
833
o33.Position = Vector3.new(-72.8801727, 0.659587979, -32.8816261)
834
o34.Parent = o33
835
o34.MeshId = "http://www.roblox.com/asset/?id=94248124"
836
o34.TextureId = "http://www.roblox.com/asset/?id=116456647"
837
o34.MeshType = Enum.MeshType.FileMesh
838
o35.Name = "12 Gauge Slugs"
839
o35.Parent = o1
840
o35.BrickColor = BrickColor.new("Medium green")
841
o35.Position = Vector3.new(-73.2401886, 0.659588993, -32.8816261)
842
o35.Rotation = Vector3.new(-90, 2.45901902e-006, 90)
843
o35.Anchored = true
844
o35.FormFactor = Enum.FormFactor.Custom
845
o35.Size = Vector3.new(0.200000003, 0.200000003, 0.550000191)
846
o35.CFrame = CFrame.new(-73.2401886, 0.659588993, -32.8816261, 1.0658141e-014, -1, 4.29179785e-008, 1.44884105e-014, 4.29179714e-008, 1, -1, -4.52982114e-008, -4.37113741e-008)
847
o35.BottomSurface = Enum.SurfaceType.Smooth
848
o35.TopSurface = Enum.SurfaceType.Smooth
849
o35.Color = Color3.new(0.631373, 0.768628, 0.54902)
850
o35.Position = Vector3.new(-73.2401886, 0.659588993, -32.8816261)
851
o36.Parent = o35
852
o36.MeshId = "http://www.roblox.com/asset/?id=94248124"
853
o36.TextureId = "http://www.roblox.com/asset/?id=116456647"
854
o36.MeshType = Enum.MeshType.FileMesh
855
o37.Parent = o1
856
o37.BrickColor = BrickColor.new("Really black")
857
o37.Position = Vector3.new(-72.967926, 0.740015984, -32.7389069)
858
o37.Rotation = Vector3.new(0, 0, 90)
859
o37.Anchored = true
860
o37.FormFactor = Enum.FormFactor.Symmetric
861
o37.Size = Vector3.new(1, 1, 1)
862
o37.CFrame = CFrame.new(-72.967926, 0.740015984, -32.7389069, 0, -1, 0, 1, 0, -0, 0, 0, 1)
863
o37.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
864
o37.Position = Vector3.new(-72.967926, 0.740015984, -32.7389069)
865
o38.Parent = o37
866
o38.Scale = Vector3.new(0.400000006, 0.699999988, 0.5)
867
o39.Name = "Welding"
868
o39.Parent = o1
869
table.insert(cors,coroutine.create(function()
870
wait()
871
runDummyScript(function()
872
function Weld(x,y)
873
	local W = Instance.new("Weld")
874
	W.Part0 = x
875
	W.Part1 = y
876
	local CJ = CFrame.new(x.Position)
877
	local C0 = x.CFrame:inverse()*CJ
878
	local C1 = y.CFrame:inverse()*CJ
879
	W.C0 = C0
880
	W.C1 = C1
881
	W.Parent = x
882
end
883
884
function Get(A)
885
	if A.className == "Part" then
886
		Weld(script.Parent.Handle, A)
887
		A.Anchored = false
888
	else
889
		local C = A:GetChildren()
890
		for i=1, #C do
891
		Get(C[i])
892
		end
893
	end
894
end
895
896
function Finale()
897
	Get(script.Parent)
898
end
899
900
script.Parent.Equipped:connect(Finale)
901
script.Parent.Unequipped:connect(Finale)
902
Finale()
903
end,o39)
904
end))
905
mas.Parent = workspace
906
mas:MakeJoints()
907
local mas1 = mas:GetChildren()
908
for i=1,#mas1 do
909
	mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack 
910
	ypcall(function() mas1[i]:MakeJoints() end)
911
end
912
mas:Destroy()
913
for i=1,#cors do
914
coroutine.resume(cors[i])
915
end