View difference between Paste ID: DebM2JXt and yjQufmsi
SHOW: | | - or go back to the newest paste.
1
--[[
2
    Smith and Wesson M&P 45, chambered in .45 ACP ammunition.
3
    The standard magazine holds 10 rounds, although magazines that could hold 14 rounds were also made but looked incredibly stupid.
4
    Credit to litozinnamon for the crosshairs and bullethole decals. I used them without permission. Not like I asked him, anyhow.
5
]]
6
7
plr=game:service'Players'.LocalPlayer
8
ch,char=plr.Character,plr.Character
9
hum=ch.Humanoid
10
tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint
11
m,mouse=plr:GetMouse(),plr:GetMouse()
12
cfn,ang,mr,int=CFrame.new,CFrame.Angles,math.rad,Instance.new
13
bc=BrickColor.new
14
head=ch.Head
15
cam=workspace.CurrentCamera
16
17
rj.C0=cfn()
18
rj.C1=cfn()
19
20
sheathed=false
21
jammed=false
22
23
24
25
26
27
28
29
30
31
32
33
local minimumsize = Vector3.new(0.7,0.7,0.7) --Minimumsize for a part to get divided,higher numbers = less detailed and bigger/less bricks
34
local surface_between_splitted_parts = 'SmoothNoOutlines' --the surface between splitted parts
35
--local fragmented = workspace:FindFirstChild("Fragmented")
36
local fragmentable = workspace --all fragmentable objects should be stored in here
37
local list = {}
38
local brickcount = 0
39
--local m = Instance.new("Hint",workspace)
40
local storage = {}
41
local fillup = 1000 --it constantly generates new parts until it reaches this number(hacky way to prevent lagspikes if there is a large explosion),change it to 0 if you don´t want it to generate (useless) parts.
42
local maximumstorage = 2000 --it will recycle parts if the number of parts in the storage doesnt exceed this number
43
local storage_position = Vector3.new(0,0,5000) --place them somewhere off the map
44
local stored_partsize = Vector3.new(1,1,1) --make them small
45
local parts_created_per_frame = 5 --number of parts being created per frame to fill up the storage
46
47
48
function fragmentate(cframe,size,color,explosion_position,explosion_blastradius,backsurface,bottomsurface,frontsurface,leftsurface,rightsurface,topsurface,transparency,reflectance)
49
	local xi = size.X >= minimumsize.X*(1+explosion_blastradius/16) and 2 or 1 --to reduce the lagg in large explosions we increase minimumsize based on the explosionradius...
50
	local yi = size.Y >= minimumsize.Y*(1+explosion_blastradius/16) and 2 or 1
51
	local zi = size.Z >= minimumsize.Z*(1+explosion_blastradius/16) and 2 or 1
52
	if xi == 1 and yi == 1 and zi == 1 or (cframe.p-explosion_position).magnitude > size.magnitude/2 + explosion_blastradius then --don´t fragmentate parts, that are too small to fragmentate or too far away from the explosion
53
		if xi == 1 and yi == 1 and zi == 1 then return end --optional
54
		if #storage > 0 then
55
			local p = storage[1]
56
			p.BrickColor = color
57
			p.Size = size
58
			p.BackSurface = backsurface
59
			p.BottomSurface = bottomsurface
60
			p.FrontSurface = frontsurface
61
			p.LeftSurface = leftsurface
62
			p.RightSurface = rightsurface
63
			p.TopSurface = topsurface
64
			p.Transparency = transparency
65
			p.CFrame = cframe
66
			p.Reflectance = reflectance
67
			table.remove(storage,1)
68
		else
69
			local p = Instance.new("Part",fragmentable)
70
			p.BrickColor = color
71
			p.FormFactor = "Custom"
72
			p.Size = size
73
			p.BackSurface = backsurface
74
			p.BottomSurface = bottomsurface
75
			p.FrontSurface = frontsurface
76
			p.LeftSurface = leftsurface
77
			p.RightSurface = rightsurface
78
			p.TopSurface = topsurface
79
			p.Transparency = transparency
80
		    if p.Transparency>0.285 then
81
			    p.Anchored = false
82
			else
83
			    p.Anchored=true
84
			    p.Material='Wood'
85
			end
86
			p.CFrame = cframe
87
			p.Reflectance = reflectance
88
		end
89
		--p:MakeJoints()
90
--		m.Text = m.Text+1
91
		return --stop the function
92
	end
93
	local mody = math.random(-125,125)/1000 --some randomization
94
	for y = 1,yi do
95
		if math.random()> 0.5 then
96
			local modx = math.random(-125,125)/1000
97
			for x = 1,xi do
98
				local modz = math.random(-125,125)/1000
99
				for z = 1,zi do --offset = x/xi-0.75+modx)
100
					fragmentate(cframe*CFrame.new(size.X*(xi==1 and 0 or x/xi-0.75+modx),size.Y*(yi==1 and 0 or y/yi-0.75+mody),size.Z*(zi==1 and 0 or z/zi-0.75+modz)), --maths
101
					Vector3.new(xi == 2 and size.X*(1-2*math.abs(x/xi-0.75+modx)) or size.X,yi == 2 and size.Y*(1-2*math.abs(y/yi-0.75+mody)) or size.Y,
102
					zi == 2 and size.Z*(1-2*math.abs(z/zi-0.75+modz)) or size.Z or agent767_was_here),color,explosion_position,explosion_blastradius,
103
					z~=zi and surface_between_splitted_parts or backsurface,y==2 and surface_between_splitted_parts or bottomsurface,
104
					z==2 and surface_between_splitted_parts or frontsurface,x==2 and surface_between_splitted_parts or leftsurface,x~=xi and surface_between_splitted_parts or rightsurface,
105
					y~=yi and surface_between_splitted_parts or topsurface,transparency,reflectance) 
106
				end
107
				
108
			end
109
		else
110
			local modz = math.random(-125,125)/1000
111
			for z = 1,zi do
112
				local modx = math.random(-125,125)/1000
113
				for x = 1,xi do
114
					fragmentate(cframe*CFrame.new(size.X*(xi==1 and 0 or x/xi-0.75+modx),size.Y*(yi==1 and 0 or y/yi-0.75+mody),size.Z*(zi==1 and 0 or z/zi-0.75+modz)),
115
					Vector3.new(xi == 2 and size.X*(1-2*math.abs(x/xi-0.75+modx)) or size.X,yi == 2 and size.Y*(1-2*math.abs(y/yi-0.75+mody)) or size.Y,
116
					zi == 2 and size.Z*(1-2*math.abs(z/zi-0.75+modz)) or size.Z),color,explosion_position,explosion_blastradius,
117
					z~=zi and surface_between_splitted_parts or backsurface,y==2 and surface_between_splitted_parts or bottomsurface,
118
					z==2 and surface_between_splitted_parts or frontsurface,x==2 and surface_between_splitted_parts or leftsurface,x~=xi and surface_between_splitted_parts or rightsurface,
119
					y~=yi and surface_between_splitted_parts or topsurface,transparency,reflectance)
120
				end
121
			end
122
		end
123
	end				
124
end
125
126
function start_fragmentation(position,radius)
127
	local search = Region3.new(position-Vector3.new(radius,radius,radius)*1.1,position+Vector3.new(radius,radius,radius)*1.1)
128
	repeat
129
	local finish = false
130
	local parts = workspace:FindPartsInRegion3WithIgnoreList(search,list,100) --maximum number of parts that FindPartsInRegion3 can find is 100, so we have to do this to find them all
131
	for i = 1,#parts do
132
		table.insert(list,1,parts[i])
133
	end
134
	finish = true
135
	until #parts < 100 and finish
136
	print(#list)
137
	local t = tick()
138
	for i = 1,#list do
139
		local p = list[i]
140
		if p:IsDescendantOf(fragmentable) and p:GetMass()<3000 and p.Transparency>0.285 and p.Name~='Base' and p:IsDescendantOf(ch)==false then
141
			fragmentate(p.CFrame,p.Size,p.BrickColor,position,radius,p.BackSurface,p.BottomSurface,p.FrontSurface,p.LeftSurface,p.RightSurface,p.TopSurface,p.Transparency,p.Reflectance)
142
			if #storage < maximumstorage and p.Shape == "Block" then --recycle them
143
				p.Anchored = false
144
				p.FormFactor = "Custom"
145
				p.Size = stored_partsize
146
				p.Position = storage_position
147
				table.insert(storage,1,p)
148
			else --storage is full
149
				p:Destroy()
150
			end
151
--			m.Text = m.Text-1
152
	    end
153
		if p:IsDescendantOf(fragmentable) and p:GetMass()<53000 and p.Transparency<0.05 and p.Name~='Base' and tostring(p.Material)=='Enum.Material.Wood' and p:IsDescendantOf(ch)==false then
154
			fragmentate(p.CFrame,p.Size,p.BrickColor,position,radius,p.BackSurface,p.BottomSurface,p.FrontSurface,p.LeftSurface,p.RightSurface,p.TopSurface,p.Transparency,p.Reflectance)
155
			if #storage < maximumstorage and p.Shape == "Block" then --recycle them
156
				p.Anchored = true
157
				p.Material='Wood'
158
				p.FormFactor = "Custom"
159
				p.Size = stored_partsize
160
				p.Position = storage_position
161
				table.insert(storage,1,p)
162
			else --storage is full
163
				p:Destroy()
164
			end
165
--			m.Text = m.Text-1
166
		end
167
	end	
168
	list = {}
169
--	print(tick()-t)
170
end
171
172
--[[
173
spawn(function()
174
    while wait() do --oh noes,a loop! So inefficient!
175
    	if #storage < fillup then
176
    		for i = 1, parts_created_per_frame do --creates parts to fill up the storage
177
    			local p = Instance.new("Part",fragmentable)
178
    			p.Anchored = false
179
    			p.FormFactor = "Custom"
180
    			p.Size = stored_partsize
181
    			p.Position = storage_position
182
    			table.insert(storage,1,p)
183
    		end
184
    	end
185
    end
186
end)
187
]]
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
--local blankn=22416261
212
213
--172121567
214
215
crosshairs={
216
    {38140824};
217
    {38140833};
218
    {38140839};
219
    {38140843};
220
    {38140852};
221
    {38140910};
222
    {38140915};
223
    {38140923};
224
    {38140928};
225
    {38140931};
226
    {38208259};
227
    {38208275};
228
    {38208284};
229
    {38208303};
230
    {38208310};
231
    {38208325};
232
    {38208330};
233
    {38208352};
234
    {38208359};
235
    {38208377}
236
}
237
238
bulletholes={
239
    172274695;
240
    172274721
241
}
242
243
for _,v in pairs(crosshairs) do
244
    game:service'ContentProvider':Preload('rbxassetid://' .. tostring(v[1]-1)) 
245
end
246
247
currentIco=2
248
switchIco=function(num)
249
    if num<20 then
250
    else
251
        num=20
252
    end
253
    mouse.Icon='rbxassetid://' .. tostring(crosshairs[num][1]-1)
254
    currentIco=num
255
end
256
257
switchIco(currentIco)
258
259
heldDown=false
260
261
spreadint=1
262
--[[Settings]]--
263
recoil=false -- Set to true for added realism
264
magCapacity=20 -- How much a magazine can hold at once
265
magAmmo=20 -- How much ammo is in the mag
266
crosshairSpread=5
267
spread=1
268
pAmmunition=true -- more damage if true
269
270
271
jamRate=500 -- How often the gun jams(the more the less) (no less than 1)
272
273
primaryColor='Really black'
274
secondaryColor='Really black'
275
276
slideReflectance=0.01
277
slideMaterial='Plastic'
278
279
--[[Attachments]]--
280
281
silencer=true
282
highCapMag=false -- High capacity magazine
283
laser=true
284
automatic=false
285
grip=true
286
local top = Instance.new("Shirt")
287
top.ShirtTemplate = "rbxassetid://76408711"
288
top.Parent = Character
289
top.Name = "Cloth"
290
local bottom = Instance.new("Pants")
291
bottom.PantsTemplate = "rbxassetid://76408697"
292
bottom.Parent = Character
293
bottom.Name = "Cloth"
294-
local PRT = CreatePart(3, Character, "Fabric", 0, 0, "Really black", "Hood", VT(1,1,1),false)
294+
local PoliceHat = New("Part",chara,"PoliceHat",{BrickColor = BrickColor.new("Really black"),FormFactor = Enum.FormFactor.Plate,Size = Vector3.new(2, 0.400000006, 1),CFrame = CFrame.new(15.3999939, 1.20000005, -20.1000061, -1, 0, 0, 0, 1, 0, 0, 0, -1),CanCollide = false,BottomSurface = Enum.SurfaceType.Weld,TopSurface = Enum.SurfaceType.Smooth,Color = Color3.new(0.0666667, 0.0666667, 0.0666667),})
295-
PRT.Color = C3(0,0,0)
295+
local Mesh = New("SpecialMesh",PoliceHat,"Mesh",{Scale = Vector3.new(1.10000002, 1.20090005, 1.10000002),MeshId = "rbxassetid://13640868",TextureId = "rbxassetid://13640869",MeshType = Enum.MeshType.FileMesh,})
296-
local HoodWeld = CreateWeldOrSnapOrMotor("Weld", Head, Head, PRT, CF(0,0.7,0), CF(0, 0, 0))
296+
local Weld = New("ManualWeld",PoliceHat,"Weld",{Part0 = PoliceHat,Part1 = Head,C1 = CFrame.new(0,.5,0),})
297-
CreateMesh("SpecialMesh", PRT, "FileMesh", "13640868 ", "13640869", VT(1,1,1)*1.05, VT(0,0,0))
297+
298
299
getSound=function(id)
300
    game:service'ContentProvider':Preload('rbxassetid'..tostring(id))
301
    local s=int("Sound",ch.Head)
302
    s.SoundId='rbxassetid://' .. tostring(id)
303
    s.Volume=1
304
    return s
305
end
306
307
local fireSound=getSound(151997297--[[10209842]])
308
fireSound.Pitch=1.3
309
--1.8
310
311
local releaseSound=getSound(10209813)
312
releaseSound.Pitch=4
313
314
local reloadSound=getSound(10209636)
315
reloadSound.Pitch=3
316
317
local magazinelockSound=getSound(152206337)
318
magazinelockSound.Pitch=1.4
319
320
local slideBackSound=getSound(152206263)
321
slideBackSound.Pitch=2.5
322
323
local slideForwardSound=getSound(152206302)
324
slideForwardSound.Pitch=2.5
325
326
local emptySound=getSound(2697295)
327
emptySound.Pitch=5
328
329
local glassBreakSound=getSound(144884907)
330
331
local woodImpact=getSound(142082171)
332
333
local fleshImpact=getSound(144884872)
334
fleshImpact.Pitch=1.7
335
336
if ch:findFirstChild("Tec-99") then
337
    ch['Tec-99']:Destroy()
338
end
339
340
local tube=int("Model",ch)
341
tube.Name='Tec-99'
342
local hopper=Instance.new('HopperBin',plr.Backpack)
343
hopper.Name=tube.Name
344
Weld = function(p0,p1,x,y,z,rx,ry,rz,par)--recommend to use this with my weld. use this function only with arm lockers.
345
    p0.Position = p1.Position
346
    local w = Instance.new('Motor',par or p0)
347
    w.Part0 = p1
348
    w.Part1 = p0
349
    w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0)
350
    w.MaxVelocity = .1
351
    return w
352
end
353
function clerp(c1,c2,sp)
354
    local R1,R2,R3 = c1:toEulerAnglesXYZ()
355
    local R21,R22,R23 = c2:toEulerAnglesXYZ()
356
    return CFrame.new(
357
    c1.X + (c2.X-c1.X)*sp,
358
    c1.Y + (c2.Y-c1.Y)*sp,
359
    c1.Z + (c2.Z-c1.Z)*sp)*CFrame.Angles(
360
    R1 + (R21-R1)*sp,
361
    R2 + (R22-R2)*sp,
362
    R3 + (R23-R3)*sp
363
    )
364
end
365
366
tweenTable={}
367
Tween = function(Weld, Stop, Step,a)
368
ypcall(function()
369
    local func = function()
370
        local Start = Weld.C1
371
        local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
372
        local Stop = Stop
373
        local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
374
        if not Step then Step=0.1 end
375
        table.insert(tweenTable,{th=0,Weld=Weld,Step=Step,Start=Start,X1=X1,Y1=Y1,Z1=Z1,Stop=Stop,X2=X2,Y2=Y2,Z2=Z2}) 
376
    end
377
        if a then coroutine.wrap(func)() else func() end
378
end)
379
end
380
weld=function(p0,p1,c0)
381
    local w=Instance.new("Weld",p0)
382
    w.Part0=p0
383
    w.Part1=p1
384
    w.C0=c0
385
    return w
386
end
387
cp=function(parent,color,size,anchored,cancollide)
388
    local newp=Instance.new("Part",parent)
389
    newp.TopSurface='SmoothNoOutlines'
390
    newp.BottomSurface='SmoothNoOutlines'
391
    newp.FrontSurface='SmoothNoOutlines'
392
    newp.BackSurface='SmoothNoOutlines'
393
    newp.RightSurface='SmoothNoOutlines'
394
    newp.LeftSurface='SmoothNoOutlines'
395
    newp.FormFactor="Custom"
396
    newp.BrickColor=bc(color)
397
    newp.Size=size
398
    newp.Anchored=anchored
399
    newp.CanCollide=cancollide
400
    newp:BreakJoints()
401
    return newp
402
end
403
404
initializeJoints=function()
405
    rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker'
406
    rabr.Position = torso.Position
407
    rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw'
408
    w = Instance.new("Weld",tube)
409
    w.Part0,w.Part1 = ch['Right Arm'],rabr
410
    w.C1 = CFrame.new(0,-.5,0)
411
    labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker'
412
    labr.Position = torso.Position
413
    lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw'
414
    ww = Instance.new("Weld",tube)
415
    ww.Part0,ww.Part1 = ch['Left Arm'],labr
416
    ww.C1 = CFrame.new(0,-.5,0)
417
end
418
419
initializeJoints()
420
421
--[[ leg locks
422
rabl = cp(tube,'White',Vector3.new(1,1,1),false,false) rabl.Transparency = 1 rabl.Name='Locker'
423
rabl.Position = torso.Position
424
rwl = Weld(rabl,torso,0.5,-1.5,0,0,0,0) rwl.Parent = tube rwl.Name = 'rwl'
425
wl = Instance.new("Weld",tube)
426
wl.Part0,wl.Part1 = ch['Right Leg'],rabl
427
wl.C1 = CFrame.new(0,-.5,0)
428
labl = cp(tube,'White',Vector3.new(1,1,1),false,false) labl.Transparency = 1 labl.Name='Locker'
429
labl.Position = torso.Position
430
lwl = Weld(labl,torso,-0.5,-1.5,0,0,0,0) lwl.Parent = tube lwl.Name = 'lwl'
431
wwl = Instance.new("Weld",tube)
432
wwl.Part0,wwl.Part1 = ch['Left Leg'],labl
433
wwl.C1 = CFrame.new(0,-.5,0)
434
]]
435
--weld(ch['HumanoidRootPart'],torso,cfn())
436
437
438
local counter=Instance.new('ScreenGui',plr.PlayerGui)
439
local frame=Instance.new('Frame',counter)
440
frame.Size=UDim2.new(0.25,0,0.3,0)
441
442
frame.Position=UDim2.new(0.1,0,0.4,0)
443
frame.BackgroundTransparency=1
444
445
local ammocounter=Instance.new('TextLabel',frame)
446
ammocounter.Size=UDim2.new(1,0,0.3,0)
447
ammocounter.Position=UDim2.new(0,0,0.2,0)
448
ammocounter.BackgroundTransparency=1
449
ammocounter.TextColor3=BrickColor.new('White').Color
450
ammocounter.Font='SourceSansBold'
451
ammocounter.FontSize='Size18'
452
ammocounter.Text=''
453
ammocounter.TextXAlignment='Left'
454
455
456
local bg = Instance.new("BodyGyro",rootpart)
457
bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
458
bg.P = 10000
459
bg.D = 100
460
461
462
cyl=function(prt)
463
    local c=int("CylinderMesh",prt)
464
    return c
465
end
466
blo=function(prt)
467
    local c=int("BlockMesh",prt)
468
    return c
469
end
470
471
if laser then
472
    aLaser=cp(tube,'Really red',Vector3.new(0.2,0.2,0.2))
473
    aLaser.Transparency=1
474
    cyl(aLaser).Scale=Vector3.new(0.25,1,0.25)
475
    aLaser.Anchored=true
476
end
477
478
local handle=cp(tube,primaryColor,Vector3.new(0.2,0.6,0.3))
479
blo(handle).Scale=Vector3.new(1.15,0.9,1)
480
local mw=weld(ch['Right Arm'],handle,cfn(-0.4,-1,-0.19)*ang(mr(-101.5),0,0)*cfn()*ang(0,mr(-30),mr(-5)))
481
482
local framepiece1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.9))
483
blo(framepiece1).Scale=Vector3.new(1.15,0.5,1)
484
weld(handle,framepiece1,cfn(0,0.354,-0.3)*ang(mr(11.5),0,0))
485
486
local barrel=cp(tube,'Medium stone grey',Vector3.new(0.2,0.2,0.2))
487
cyl(barrel).Scale=Vector3.new(0.7,1.2,0.7)
488
weld(framepiece1,barrel,cfn(0,0.15,-0.1)*ang(mr(-90),0,0))
489
    
490
local sbarrel=cp(tube,'Really black',Vector3.new(0.2,0.3,0.2))
491
cyl(sbarrel).Scale=Vector3.new(0.7,1.5,0.7)
492
weld(barrel,sbarrel,cfn(0,0.35,0))
493
local hole=cp(tube,'White',Vector3.new(0.2,0.2,0.2))
494
hole.Transparency=1
495
weld(sbarrel,hole,cfn(0,0.2,0))
496
local flash=int('PointLight',hole)
497
flash.Enabled=false
498
flash.Range=10
499
flash.Color=BrickColor.new('Neon orange').Color
500
501
    
502
local slide1=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.4))
503
slide1.CanCollide=false
504
blo(slide1).Scale=Vector3.new(0.7,1,1.1)
505
slideweld1=weld(framepiece1,slide1,cfn(0,0.15,0.23))
506
slide1.Reflectance=slideReflectance
507
slide1.Material=slideMaterial
508
509
local slide2=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.4))
510
slide2.CanCollide=false
511
blo(slide2).Scale=Vector3.new(0.7,1,1.1)
512
slideweld2=weld(slide1,slide2,cfn(0,0,-0.666))
513
slide2.Reflectance=slideReflectance
514
slide2.Material=slideMaterial
515
    
516
local slideside1=cp(tube,secondaryColor,Vector3.new(0.2,0.2,1.1))
517
slideside1.CanCollide=true
518
blo(slideside1).Scale=Vector3.new(0.25,1,1)
519
weld(slide1,slideside1,cfn(-0.09,0,-0.335))
520
slideside1.Reflectance=slideReflectance
521
slideside1.Material=slideMaterial
522
523
local slideside2=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.4))
524
slideside2.CanCollide=true
525
blo(slideside2).Scale=Vector3.new(0.25,1,1.1)
526
weld(slide1,slideside2,cfn(0.09,0,0))
527
slideside2.Reflectance=slideReflectance
528
slideside2.Material=slideMaterial
529
530
local slideside3=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.3))
531
slideside3.CanCollide=true
532
blo(slideside3).Scale=Vector3.new(0.25,0.6,0.78)
533
weld(slideside2,slideside3,cfn(0,-0.04,-0.335))
534
slideside3.Reflectance=slideReflectance
535
slideside3.Material=slideMaterial
536
537
local slideside4=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.4))
538
blo(slideside4).Scale=Vector3.new(0.25,1,1.1)
539
weld(slide2,slideside4,cfn(0.09,0,0))
540
slideside4.Reflectance=slideReflectance
541
slideside4.Material=slideMaterial
542
543
local mgs=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
544
blo(mgs).Scale=Vector3.new(1.15,0.425,0.245)
545
weld(handle,mgs,cfn(0,-0.3,0.125))
546
547
--[[Trigger]]--
548
local tp1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
549
blo(tp1).Scale=Vector3.new(0.6,0.1,0.8)
550
weld(framepiece1,tp1,cfn(0,-0.22,0.13))
551
552
local tp2=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
553
blo(tp2).Scale=Vector3.new(0.6,0.1,1.19)
554
weld(framepiece1,tp2,cfn(0,-0.14,-0.0265)*ang(mr(45),0,0))
555
556
local trigger1=cp(tube,'Really black',Vector3.new(0.2,0.2,0.2))
557
blo(trigger1).Scale=Vector3.new(0.3,0.4,0.16)
558
weld(framepiece1,trigger1,cfn(0,-0.07,0.09))
559
    
560
local trigger2=cp(tube,'Really black',Vector3.new(0.2,0.2,0.2))
561
blo(trigger2).Scale=Vector3.new(0.3,0.3,0.16)
562
weld(trigger1,trigger2,cfn(0,-0.06,-0.015)*ang(mr(30),0,0))
563
    
564
    
565
--[[Magazine]]--
566
567
local magh=cp(tube,'Really black',Vector3.new(0.2,0.5,0.2))
568
blo(magh).Scale=Vector3.new(0.6,1,1)
569
local magweld=weld(handle,magh,cfn(0,-0.025,0))
570
    
571
local bottom=cp(tube,'Really black',Vector3.new(0.2,0.2,0.3))
572
blo(bottom).Scale=Vector3.new(1.15,0.385,0.8)
573
bottomweld=weld(magh,bottom,cfn(0,-0.28,-0.015))
574
    
575
if highCapMag then
576
    magweld:Destroy()    
577
    magh.Size=Vector3.new(0.2,0.7,0.2)
578
    magweld=weld(handle,magh,cfn(0,-0.125,0))
579
    bottomweld:Destroy()
580
    bottomweld=weld(magh,bottom,cfn(0,-0.38,-0.015))
581
    magCapacity=magCapacity+23
582
    magAmmo=magAmmo+23
583
end
584
    
585
--[[Sights]]--
586
local backsight1=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
587
blo(backsight1).Scale=Vector3.new(0.3,0.3,0.3)
588
weld(slide1,backsight1,cfn(0.06,0.1,0.13))
589
local backsight2=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
590
blo(backsight2).Scale=Vector3.new(0.3,0.3,0.3)
591
weld(slide1,backsight2,cfn(-0.06,0.1,0.13))
592
593
local frontsight=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
594
blo(frontsight).Scale=Vector3.new(0.3,0.3,0.3)
595
weld(slide1,frontsight,cfn(0,0.1,-0.85))
596
    
597
local dot1=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
598
cyl(dot1).Scale=Vector3.new(0.1,0.31,0.1)
599
weld(backsight1,dot1,cfn(0,0.014,0)*ang(mr(-90),0,0))
600
    
601
local dot2=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
602
cyl(dot2).Scale=Vector3.new(0.1,0.31,0.1)
603
weld(backsight2,dot2,cfn(0,0.014,0)*ang(mr(-90),0,0))
604
    
605
local dot3=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
606
cyl(dot3).Scale=Vector3.new(0.1,0.31,0.1)
607
weld(frontsight,dot3,cfn(0,0.014,0)*ang(mr(-90),0,0))
608
609
local ba=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.2))
610
blo(ba).Scale=Vector3.new(1.15,0.5,1)
611
weld(framepiece1,ba,cfn(0,0,-0.55))
612
ba.Reflectance=slideReflectance
613
ba.Material=slideMaterial
614
615
local weirdholethatpistolshave=cp(tube,'Really black', Vector3.new(0.2,0.2,0.2))
616
cyl(weirdholethatpistolshave).Scale=Vector3.new(0.4,1.01,0.4)
617
weld(ba,weirdholethatpistolshave,cfn(0,0,0)*ang(mr(-90),0,0))
618
619
--[[Tactical Rails]]--
620
621
local r1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
622
blo(r1).Scale=Vector3.new(1.15,0.2,0.25)
623
weld(framepiece1,r1,cfn(0,-0.05,-0.17))
624
625
local r2=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
626
blo(r2).Scale=Vector3.new(1.15,0.2,0.25)
627
weld(framepiece1,r2,cfn(0,-0.05,-0.27))
628
    
629
local r3=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
630
blo(r3).Scale=Vector3.new(1.15,0.2,0.25)
631
weld(framepiece1,r3,cfn(0,-0.05,-0.37))
632
    
633
if laser then
634
    local base=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.3))
635
    blo(base).Scale=Vector3.new(1.15,1,1)
636
    weld(r2,base,cfn(0,-0.05,0))
637
    basehole=cp(tube,'White',Vector3.new(0.2,0.2,0.2))
638
    cyl(basehole).Scale=Vector3.new(0.4,0.4,0.4)
639
    weld(base,basehole,cfn(0,0,-0.13)*ang(mr(-90),0,0))
640
end
641
642
if silencer then
643
    local sil=cp(tube,'Really black',Vector3.new(0.2,0.3,0.2))
644
    fireSound.SoundId='rbxassetid://153230595'
645
    fireSound.Pitch=1
646
    cyl(sil).Scale=Vector3.new(0.94,1.8,0.94)
647
    weld(hole,sil,cfn(0,0.29,0))
648
end
649
650
if grip then
651
    local base=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.3))
652
    blo(base).Scale=Vector3.new(1.15,1,1)
653
    weld(r2,base,cfn(0,-0.05,0))
654
    local hd=cp(tube,primaryColor,Vector3.new(0.2,0.6,0.2))
655
    cyl(hd)
656
    weld(base,hd,cfn(0,-0.3,0))
657
    crosshairSpread=3
658
    spreadint=spreadint-0.3
659
end
660
661
--[[Test Functions]]--
662
663
local debounce=false
664
local out=false
665
local bs=false
666
cockSlide=function() -- hahaha yes i know
667
    slideBackSound:Play()
668
    if magAmmo<1 and out==true and bs==false then
669
        wait()
670
        slideweld1.C0=slideweld1.C0*cfn(0,0,0.22) 
671
    else
672
        for i=1,2 do
673
            wait()
674
            slideweld1.C0=slideweld1.C0*cfn(0,0,0.22) 
675
        end
676
    end
677
    local ajar=false
678
    if magAmmo==1 then
679
        ajar=true 
680
    end
681
    if magAmmo>0 then
682
        createShell()
683
        --magAmmo=magAmmo-1
684
        ammocounter.Text=''
685
        for i=1,magAmmo do
686
           ammocounter.Text=ammocounter.Text .. 'I' 
687
        end
688
    end
689
    wait(0.15)
690
    slideForwardSound:Play()
691
    for i=1,2 do
692
        wait()
693
        slideweld1.C0=slideweld1.C0*cfn(0,0,-0.22) 
694
    end
695
    if ajar==true then
696
        out=true
697
        slideweld1.C0=cfn(0,0.15,0.23)
698
        slideweld1.C0=slideweld1.C0*cfn(0,0,0.22) 
699
    end
700
end
701
702
--fx
703
local firefx=cp(tube,'Neon orange',Vector3.new(0.7,1.1,0.7))
704
firefx.Transparency=1
705
local mesh=Instance.new('SpecialMesh',firefx)
706
mesh.MeshType='Sphere'
707
firefx.Material='Neon'
708
weld(hole,firefx,cfn(0,1,0))
709
710
local smokefx=Instance.new('Smoke',hole)
711
smokefx.Enabled=false
712
barrel.CanCollide=true
713
714
715
716
717
local oc = oc or function(...) return ... end
718
719
function ragJoint(hit,r,d)
720
    Spawn(oc(function()
721
    d = d or 0
722
    local rpar,r0,r1 = r.Parent,r.Part0,r.Part1
723
    if d > 0 then wait(d) end
724
    local p = hit:Clone()
725
    p:BreakJoints()
726
    p:ClearAllChildren()
727
    p.FormFactor = "Custom"
728
    p.Size = p.Size/2
729
    p.Transparency = 1
730
    p.CanCollide = true
731
    p.Name = "Colliduh"
732
    p.Parent = hit
733
    local w = Instance.new("Weld",p)
734
    w.Part0 = hit
735
    w.Part1 = p
736
    w.C0 = CFrame.new(0,-p.Size.Y/2,0)
737
    local rot = Instance.new("Rotate",rpar)
738
    rot.Name = r.Name
739
    rot.Part0 = r0
740
    rot.Part1 = r1
741
    rot.C0 = r.C0
742
    rot.C1 = r.C1
743
    r0.Velocity = Vector3.new()
744
    r1.Velocity = Vector3.new()
745
    r:Destroy()
746
    end))
747
end
748
749
750
createShell=function()
751
    local shell=cp(tube,'Deep orange',Vector3.new(0.2,0.3,0.2))
752
    shell.CanCollide=true
753
    shell.Reflectance=0.3
754
    cyl(shell)
755
    shell.CFrame=barrel.CFrame*ang(mr(-90),0,0)
756
    magAmmo=magAmmo-1
757
    ammocounter.Text=''
758
    for i=1,magAmmo do
759
        ammocounter.Text=ammocounter.Text .. 'I' 
760
    end
761
    game.Debris:AddItem(shell,3)
762
end
763
764
reloadPistol=function()
765
    local current=magAmmo
766
    Tween(lw,cfn())
767
    Tween(rw,cfn()*ang(mr(-102),0,0))
768
    wait(0.4)
769
    releaseSound:Play()
770
    bottom.Transparency=1
771
    magh.Transparency=1
772
    local mag1=magh:clone()
773
    mag1.Transparency=0
774
    mag1.Weld:Destroy''
775
    local mag2=bottom:clone()
776
    mag2.Transparency=0
777
    mag1:BreakJoints''
778
    mag2:BreakJoints''
779
    local bm1=mag1:clone()
780
    local bm2=mag2:clone()
781
    mag1.Parent=tube
782
    mag2.Parent=tube
783
    mag1.CFrame=magh.CFrame
784
    weld(mag1,mag2,cfn(0,-0.28,-0.015))
785
    magAmmo=0
786
    ammocounter.Text=''
787
    for i=1,magAmmo do
788
        ammocounter.Text=ammocounter.Text .. 'I' 
789
    end
790
    wait()
791
    mag1.CanCollide=true
792
    mag2.CanCollide=true
793
    game.Debris:AddItem(mag1,2)
794
    game.Debris:AddItem(mag2,2)
795
    wait(0.1)
796
    Tween(lw,cfn()*ang(mr(25),0,0))
797
    bm1.Parent=tube
798
    bm2.Parent=tube
799
    weld(bm1,bm2,cfn(0,-0.28,-0.015))
800
    local fa=weld(ch['Left Arm'],bm1,cfn(0,-1.1,0)*ang(mr(-90),0,0))
801
    wait(0.1)
802
    Tween(lw,cfn(0,1.4,0)*ang(mr(-109),mr(60),mr(10)),0.07)
803
    wait(0.25)
804
    magazinelockSound:Play()
805
    wait()
806
   -- reloadSound:Play()
807
    fa:Destroy''
808
    bm1:Destroy''
809
    bm2:Destroy''
810
    bottom.Transparency=0
811
    magh.Transparency=0
812
    local totalcap=0
813
    if current<1 then --none in chamber reload
814
        --slideweld1.C0=cfn(0,0,0.45)
815
        Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0))
816
        Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(35),0))
817
        wait(0.1)
818
        spawn(function()
819
            cockSlide()
820
        end)
821
        Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(55),0))
822
        wait(0.3)
823
        totalcap=magCapacity
824
    else
825
        totalcap=magCapacity+1
826
    end
827
    magAmmo=totalcap
828
    out=false
829
    ammocounter.Text=''
830
    for i=1,magAmmo do
831
        ammocounter.Text=ammocounter.Text .. 'I' 
832
    end
833
    restorePosition()
834
end
835
836
firePistol=function()
837
    switchIco(currentIco+crosshairSpread)
838
    if not jammed and not out then
839
        spread=spread+spreadint
840
    end
841
    print(spread)
842
    fireSound.Pitch=math.random(math.random(fireSound.Pitch-0.2,fireSound.Pitch-0.1),math.random(fireSound.Pitch,fireSound.Pitch+0.1))
843
    if magAmmo>0 and jammed==false then
844
        local ajar=false
845
        if magAmmo==1 then
846
            ajar=true
847
        end
848
        user=ch
849
    	local ray = Ray.new(hole.CFrame.p, ((m.Hit.p+Vector3.new(math.random(-spread,spread)/6.35,math.random(-spread,spread)/6.35,math.random(-spread,spread)/6.35) )- hole.CFrame.p).unit*300)
850
        local hit, position = game.Workspace:FindPartOnRay(ray, user)
851
        if hit then
852
            if hit.Transparency>0.285 and hit:GetMass()<3000 and hit.Parent.className~='Hat' then
853
                local temps=glassBreakSound:clone()
854
                temps.Parent=hit
855
                temps.Pitch=math.random(math.random(temps.Pitch-0.2,temps.Pitch-0.1),math.random(temps.Pitch,temps.Pitch+0.1))
856
                temps:Play''
857
                start_fragmentation(position,.25) 
858
            end
859
            if tostring(hit.Material)=='Enum.Material.Wood' and hit.Transparency<0.05 then
860
                local temps=woodImpact:clone()
861
                temps.Volume=1
862
                temps.Pitch=math.random(math.random(temps.Pitch-0.2,temps.Pitch-0.1),math.random(temps.Pitch,temps.Pitch+0.1))
863
                temps.Parent=hit
864
                temps:Play''
865
                start_fragmentation(position,.15)
866
            end
867
            ypcall(function()
868
                if hit and hit.Parent and hit.Parent:findFirstChild'Humanoid' then
869
                    local temps=fleshImpact:clone()
870
                    temps.Parent=hit
871
                    temps:Play()
872
                    if hit.Name~='Head' then
873
                        if pAmmunition==true then
874
                	        hit.Parent.Humanoid:TakeDamage(math.random(30,65))
875
                	    else
876
                	        hit.Parent.Humanoid:TakeDamage(math.random(10,24))
877
                	    end
878
                	    local guy=hit.Parent
879
                	    if guy.Name~='TheDarkRevenant' then
880
                            for i,v in pairs(guy:GetChildren()) do
881
                                if v.className=='Hat' then
882
                                    v.Handle:BreakJoints()
883
                                end
884
                                local r = guy.Torso:FindFirstChild(v.Name:gsub("Arm","Shoulder"):gsub("Leg","Hip"))
885
                                if v:IsA("BasePart") and r then
886
                                    ragJoint(v,r,.1)
887
                                elseif v:IsA("Humanoid") then
888
                                    spawn(function()
889
                                        wait(0.5)
890
                                        v.PlatformStand = true
891
                                        v.Changed:connect(function()
892
                                            v.PlatformStand = true
893
                                        end)
894
                                    end)
895
                                end
896
                            end
897
                        end
898
                    
899
                	else
900
                	    if hit.Parent.Name~='TheDarkRevenant' then
901
                	        hit.Parent:BreakJoints() 
902
                	    end
903
                	end
904
                end
905
906
            if hit.Parent.className=='Hat' then
907
                hit.CanCollide=true
908
                hit:BreakJoints()
909
                hit.Velocity=m.Hit.p*5
910
            end
911
        end)
912
        end
913
        if m.Target then
914
            local p = Instance.new("Part")
915
            p.formFactor = "Custom"
916
            p.Size = Vector3.new(0.5,0.5,0.5)
917
            p.Transparency = 1
918
            p.CanCollide = false
919
            p.Locked = true
920
            p.CFrame = CFrame.new(position.x,position.y,position.z)--mouse.Target.CFrame+(mouse.Hit.p-mouse.Target.Position)
921
            local w = Instance.new("Weld")
922
            w.Part0 = mouse.Target
923
            w.Part1 = p
924
            w.C0 = mouse.Target.CFrame:inverse()
925
            w.C1 = p.CFrame:inverse()
926
            w.Parent = p
927
            local d = Instance.new("Decal")
928
            d.Parent = p
929
            d.Face = mouse.TargetSurface
930
            d.Texture = 'rbxassetid://' .. tostring(bulletholes[math.random(#bulletholes)]-2)
931
            p.Parent = tube
932
            game.Debris:AddItem(p,6)
933
        end
934
        if recoil==true then
935
            cam:SetRoll(math.random(-2,2))
936
            cam:TiltUnits(0.501)
937
        end
938
        local th=cp(tube,"Really black",Vector3.new(1,1,1))
939
        th.CanCollide=false
940
        th.Anchored=true
941
        th.CFrame=CFrame.new(position.x,position.y,position.z)
942
        local spm=Instance.new('SpecialMesh',th)
943
    	spm.MeshType='Sphere'
944
    	spm.Scale=Vector3.new(0.05,0.05,0.05)
945
        spawn(function()
946
    		for i=1,5 do
947
    			wait()
948
    			spm.Scale=spm.Scale+Vector3.new(0.16,0.16,0.16)
949
    			th.Transparency=th.Transparency+0.2
950
    		end
951
    		th:Destroy()
952
    	end)
953
        fireSound:Play()
954
        spawn(function()
955
            firefx.Transparency=0
956
            wait()
957
            firefx.Transparency=1
958
        end)
959
        spawn(function()
960
            flash.Enabled=true
961
            for i=1,2 do
962
                wait()
963
                slideweld1.C0=slideweld1.C0*cfn(0,0,0.22) 
964
            end
965
            flash.Enabled=false
966
            createShell()
967
            for i=1,2 do
968
                wait()
969
                slideweld1.C0=slideweld1.C0*cfn(0,0,-0.22) 
970
            end
971
            slideweld1.C0=cfn(0,0.15,0.23)
972
            if ajar==true then
973
                out=true
974
                slideweld1.C0=cfn(0,0.15,0.23)
975
                slideweld1.C0=slideweld1.C0*cfn(0,0,0.22) 
976
            end
977
        end)
978
        ammocounter.Text=''
979
        for i=1,magAmmo do
980
           ammocounter.Text=ammocounter.Text .. 'I' 
981
        end
982
        wait()
983
        Tween(rw,cfn(0,0.7,0)*ang(mr(-100),mr(-30),0),0.62)
984
        if not grip then
985
            Tween(lw,cfn(0,0.7,0)*ang(mr(-100),mr(30),0),0.62)
986
        else
987
            Tween(lw,cfn(0,1.3,0)*ang(mr(-100),mr(30),0),0.62) 
988
        end
989
        wait(0.065)
990
        restorePosition(0.3)
991
    else
992
        if magAmmo<1 then
993
            slideweld1.C0=cfn(0,0.15,0.23)
994
            slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
995
        end
996
        emptySound:Play()
997
    end
998
    if math.random(jamRate)==jamRate and magAmmo>0 then
999
        jammed=true
1000
    end
1001
end
1002
1003
debounced=function()
1004
    if sheathed==false and debounce==false then
1005
        return true
1006
    end
1007
end
1008
1009
mouse.Button1Down:connect(function()
1010
    if debounced() then
1011
        if automatic==false then
1012
            debounce=true
1013
            firePistol()
1014
            debounce=false
1015
        else
1016
         heldDown=true 
1017
            firePistol()
1018
        end
1019
    end
1020
end)
1021
1022
mouse.Button1Up:connect(function()
1023
    heldDown=false
1024
end)
1025
1026
sheathGun=function()
1027
    ammocounter.Visible=false
1028
    if laser then
1029
        laserEnabled=false
1030
        aLaser.Transparency=1
1031
    end
1032
    Tween(rw,cfn())
1033
    Tween(lw,cfn())
1034
    wait(0.1)
1035
    mw:Destroy''
1036
    mw=nil
1037
    mw=weld(tor,handle,cfn(1.11,-1.09,0)*ang(mr(-111.5),0,0))
1038
    labr:Destroy()
1039
    rabr:Destroy()
1040
    bg.maxTorque=Vector3.new()
1041
    sheathed=true
1042
end
1043
1044
unsheathGun=function()
1045
    ammocounter.Visible=true
1046
    mw:Destroy''
1047
    mw=nil
1048
    initializeJoints()
1049
    mw=weld(ch['Right Arm'],handle,cfn(-0.4,-1,-0.19)*ang(mr(-101.5),0,0)*cfn()*ang(0,mr(-30),mr(-5)))
1050
    restorePosition()
1051
    bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
1052
    sheathed=false
1053
end
1054
1055
laserEnabled=false
1056
1057
mouse.KeyDown:connect(function(key)
1058
    if key=='r' and debounced() then
1059
        debounce=true
1060
        reloadPistol()
1061
        debounce=false
1062
    elseif key=='f' and debounced() then
1063
        debounce=true
1064
        bs=true
1065
        Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0))
1066
        Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(35),0))
1067
        wait(0.1)
1068
        spawn(function()
1069
            cockSlide()
1070
        end)
1071
        Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(55),0))
1072
        wait(0.3)
1073
        jammed=false
1074
        restorePosition()
1075
        bs=false
1076
        debounce=false
1077
    elseif key=='l' and debounced() then
1078
        if not laserEnabled then
1079
            laserEnabled=true
1080
            aLaser.Transparency=0.35
1081
        else
1082
            laserEnabled=false
1083
            aLaser.Transparency=1
1084
        end
1085
    end
1086
end)
1087
1088
restorePosition=function(speed)
1089
    if not grip then
1090
        Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0),speed)
1091
        Tween(lw,cfn(0,0.7,0)*ang(mr(-90),mr(30),0),speed)
1092
    else
1093
        Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0),speed)
1094
        Tween(lw,cfn(0,1.3,0)*ang(mr(-90),mr(30),0),speed)
1095
    end
1096
end
1097
1098
hopper.Selected:connect(function()
1099
    unsheathGun()
1100
end)
1101
1102
hopper.Deselected:connect(function()
1103
    sheathGun()
1104
end)
1105
1106
game:service'RunService'.RenderStepped:connect(function()
1107
    bg.cframe = CFrame.new(rootpart.Position,mouse.Hit.p*Vector3.new(1,0,1)+rootpart.Position*Vector3.new(0,1,0))
1108
    if laserEnabled==true then
1109
        local user=ch
1110
    	local ray = Ray.new(hole.CFrame.p, (m.Hit.p - hole.CFrame.p).unit*300)
1111
        local hit, position = game.Workspace:FindPartOnRay(ray, user)
1112
        local distance = (position - basehole.CFrame.p).magnitude
1113
        aLaser.Size=Vector3.new(0.2,distance,0.2)
1114
        aLaser.CFrame=CFrame.new(position, basehole.CFrame.p) * CFrame.new(0, 0, -distance/2) * ang(mr(-90),0,0)
1115
    end
1116
    for _,v in pairs(tweenTable) do
1117
        if v.Weld.C1==v.Stop then
1118
            table.remove(tweenTable,_)
1119
        else
1120
            if v.th<0.9 then
1121
                v.th=v.th+v.Step
1122
                i=v.th
1123
                v.Weld.C1 = CFrame.new( (v.Start.p.X * (1 - i)) + (v.Stop.p.X * i), 
1124
                (v.Start.p.Y * (1 - i)) + (v.Stop.p.Y * i), 
1125
                (v.Start.p.Z * (1 - i)) + (v.Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
1126
                (v.X1 * (1 - i)) + (v.X2 * i), (v.Y1 * (1 - i)) + (v.Y2 * i),
1127
                (v.Z1 * (1 - i)) + (v.Z2 * i) )
1128
            else
1129
                v.Weld.C1 = v.Stop
1130
            end
1131
        end
1132
    end
1133
end)
1134
for i=1,magAmmo do
1135
   ammocounter.Text=ammocounter.Text .. 'I' 
1136
end
1137
1138
sheathGun()
1139
1140
spawn(function()
1141
    while wait(0.07) do
1142
        if heldDown==true then
1143
            spawn(function()
1144
                firePistol()
1145
            end)
1146
        end
1147
    end
1148
end)
1149
m.TargetFilter=tube
1150
1151
while wait(0.03) do
1152
    if spread>1 then
1153
       spread=spread-spreadint/4
1154
    end
1155
    if spread<1 then
1156
       spread=1 
1157
    end
1158
    if currentIco>2 then
1159
       switchIco(currentIco-1)
1160
    end
1161
end
1162
1163
--hl/https://httpget-inumeration.c9.io/mp45.lua
1164
--local/game.Players.Conmiro:Destroy''