SHOW:
|
|
- or go back to the newest paste.
1 | - | --[[ |
1 | + | |
2 | - | Jaginator's MP412 |
2 | + | |
3 | - | --]] |
3 | + | |
4 | ||
5 | Player = game.Players.SmokeDelsin | |
6 | Name = "MP412" | |
7 | MC = BrickColor.new("Really blue") | |
8 | GC = BrickColor.new("Really red") | |
9 | - | Player = game.Players.Your Name Here |
9 | + | |
10 | MR = 0.15 | |
11 | Chamber = 1 | |
12 | Loaded = 0 | |
13 | Scoped = false | |
14 | Scoped = false | |
15 | selected = false | |
16 | Hammer = true | |
17 | canDual = false | |
18 | dual = true | |
19 | Button1Down = false | |
20 | damage = 10 | |
21 | canFire = false | |
22 | canFire2 = true | |
23 | readyTime = 0.000023 | |
24 | automatic = false | |
25 | burst = false | |
26 | burstCount = 0 | |
27 | burstCountMax = 3 | |
28 | canSilence = false | |
29 | silenced = false | |
30 | canZoom = true | |
31 | zoom = false | |
32 | switchToSingle = true | |
33 | switchToBurst = true | |
34 | switchToAutomatic = true | |
35 | ||
36 | ||
37 | ammoGui = Instance.new("ScreenGui") | |
38 | ammoGui.Name = Name | |
39 | local frame = Instance.new("Frame") | |
40 | frame.Name = "Frame" | |
41 | frame.Size = UDim2.new(0, 165, 0, 60) | |
42 | frame.Position = UDim2.new(0, 0, 1, -400) | |
43 | frame.BackgroundColor3 = Color3.new(1, 1, 1) | |
44 | frame.BorderColor3 = Color3.new(0, 0, 0) | |
45 | frame.Parent = ammoGui | |
46 | local label = Instance.new("TextLabel") | |
47 | label.Name = "Weapon" | |
48 | label.Text = "Weapon: " ..Name | |
49 | label.Size = UDim2.new(1, 0, 0, 20) | |
50 | label.Position = UDim2.new(0, 0, 0, 0) | |
51 | label.BackgroundColor3 = Color3.new(1, 0, 0) | |
52 | label.BorderColor3 = Color3.new(0, 0, 0) | |
53 | label.Parent = frame | |
54 | local label = Instance.new("TextLabel") | |
55 | label.Name = "MagazinePrefix" | |
56 | label.Text = " Magazine:" | |
57 | label.TextXAlignment = "Left" | |
58 | label.Size = UDim2.new(1, 0, 0, 20) | |
59 | label.Position = UDim2.new(0, 0, 0, 20) | |
60 | label.BackgroundColor3 = Color3.new(1, 1, 1) | |
61 | label.BorderColor3 = Color3.new(0, 0, 0) | |
62 | label.Parent = frame | |
63 | local label = Instance.new("TextLabel") | |
64 | label.Name = "Magazine" | |
65 | label.Text = "0/0" | |
66 | label.TextXAlignment = "Right" | |
67 | label.Size = UDim2.new(1, 0, 0, 20) | |
68 | label.Position = UDim2.new(0, -10, 0, 20) | |
69 | label.BackgroundTransparency = 1 | |
70 | label.BorderSizePixel = 0 | |
71 | label.Parent = frame | |
72 | local label = Instance.new("TextLabel") | |
73 | label.Name = "AmmoPrefix" | |
74 | label.Text = " .357 Magnum:" | |
75 | label.TextXAlignment = "Left" | |
76 | label.Size = UDim2.new(1, 0, 0, 20) | |
77 | label.Position = UDim2.new(0, 0, 0, 40) | |
78 | label.BackgroundColor3 = Color3.new(1, 1, 1) | |
79 | label.BorderColor3 = Color3.new(0, 0, 0) | |
80 | label.Parent = frame | |
81 | local label = Instance.new("TextLabel") | |
82 | label.Name = "Ammo" | |
83 | label.Text = "0/0" | |
84 | label.TextXAlignment = "Right" | |
85 | label.Size = UDim2.new(1, 0, 0, 20) | |
86 | label.Position = UDim2.new(0, -10, 0, 40) | |
87 | label.BackgroundTransparency = 1 | |
88 | label.BorderSizePixel = 0 | |
89 | label.Parent = frame | |
90 | ||
91 | ||
92 | function updateGui() | |
93 | if selected == false then return end | |
94 | if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end | |
95 | if Player.PlayerGui:FindFirstChild(Name) == nil then | |
96 | ammoGui:Clone().Parent = Player.PlayerGui | |
97 | end | |
98 | Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value) | |
99 | Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value) | |
100 | end | |
101 | ||
102 | ||
103 | function makeParts(format) | |
104 | local model = Instance.new("Model") | |
105 | model.Name = Name | |
106 | local pm = Instance.new("Part") | |
107 | pm.Name = "Handle" | |
108 | pm.formFactor = "Symmetric" | |
109 | pm.Size = Vector3.new(1, 1, 1) | |
110 | pm.BrickColor = MC | |
111 | pm.Reflectance = MR | |
112 | pm.Transparency = 1 | |
113 | pm.CanCollide = false | |
114 | pm.Locked = true | |
115 | pm.TopSurface = 0 | |
116 | pm.BottomSurface = 0 | |
117 | pm.Parent = model | |
118 | local m = Instance.new("SpecialMesh") | |
119 | m.MeshType = "Brick" | |
120 | m.Scale = Vector3.new(0.3, 0.8, 0.4) | |
121 | m.Parent = pm | |
122 | if format ~= nil then | |
123 | local w = Instance.new("Weld") | |
124 | w.Part0 = pm | |
125 | if format == "RightHand" then | |
126 | w.Part1 = Player.Character:FindFirstChild("Right Arm") | |
127 | w.C0 = CFrame.new(0, 0.9, 0.68) | |
128 | w.C1 = CFrame.new() | |
129 | elseif format == "LeftHand" then | |
130 | w.Part1 = Player.Character:FindFirstChild("Left Arm") | |
131 | w.C0 = CFrame.new(0, 0.9, 0.68) | |
132 | w.C1 = CFrame.new() | |
133 | model.Name = Name.. " (Left)" | |
134 | elseif format == "RightHolster" then | |
135 | w.Part1 = Player.Character:FindFirstChild("Right Leg") | |
136 | w.C0 = CFrame.new(-0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0) | |
137 | w.C1 = CFrame.new() | |
138 | w.Parent = pm | |
139 | model.Name = Name.. " (Holstered)" | |
140 | elseif format == "LeftHolster" then | |
141 | w.Part1 = Player.Character:FindFirstChild("Left Leg") | |
142 | w.C0 = CFrame.new(0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0) | |
143 | w.C1 = CFrame.new() | |
144 | model.Name = Name.. " (Holstered, Left)" | |
145 | end | |
146 | w.Parent = pm | |
147 | model.Parent = Player.Character | |
148 | end | |
149 | local s = Instance.new("Sound") | |
150 | s.Name = "Fire" | |
151 | s.SoundId = "http://www.roblox.com/Asset/?id=10209875" | |
152 | s.Volume = .5 | |
153 | s.Pitch = 50 | |
154 | s.Looped = false | |
155 | s.Parent = pm | |
156 | local s = Instance.new("Sound") | |
157 | s.Name = "Reload" | |
158 | s.SoundId = "http://www.roblox.com/Asset/?id=10209894" | |
159 | s.Volume = 0.8 | |
160 | s.Pitch = 4 | |
161 | s.Looped = false | |
162 | s.Parent = pm | |
163 | local s = Instance.new("Sound") | |
164 | s.Name = "Empty" | |
165 | s.SoundId = "http://www.roblox.com/asset/?id=2697295" | |
166 | s.Volume = 1 | |
167 | s.Pitch = 5 | |
168 | s.Looped = false | |
169 | s.Parent = pm | |
170 | local s = Instance.new("Sound") | |
171 | s.Name = "Lock" | |
172 | s.SoundId = "http://www.roblox.com/Asset/?id=10209845" | |
173 | s.Volume = 1 | |
174 | s.Pitch = 3 | |
175 | s.Looped = false | |
176 | s.Parent = pm | |
177 | local s = Instance.new("Sound") | |
178 | s.Name = "Release" | |
179 | s.SoundId = "http://www.roblox.com/Asset/?id=10209813" | |
180 | s.Volume = 1 | |
181 | s.Pitch = 4 | |
182 | s.Looped = false | |
183 | s.Parent = pm | |
184 | local s = Instance.new("Sound") | |
185 | s.Name = "Switch" | |
186 | s.SoundId = "http://www.roblox.com/asset/?id=2697295" | |
187 | s.Volume = 1 | |
188 | s.Pitch = 10 | |
189 | s.Looped = false | |
190 | s.Parent = pm | |
191 | local p = Instance.new("Part") | |
192 | p.Name = "ShellOut" | |
193 | p.formFactor = "Symmetric" | |
194 | p.Size = Vector3.new(1, 1, 1) | |
195 | p.Transparency = 1 | |
196 | p.Locked = true | |
197 | p.CanCollide = false | |
198 | p.TopSurface = 0 | |
199 | p.BottomSurface = 0 | |
200 | p.Parent = model | |
201 | local w = Instance.new("Weld") | |
202 | w.Part0 = p | |
203 | w.Part1 = pm | |
204 | w.C0 = CFrame.new(0.5, 0, 0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0) | |
205 | w.C1 = CFrame.new() | |
206 | w.Parent = p | |
207 | local p = Instance.new("Part") | |
208 | p.Name = "Grip" | |
209 | p.formFactor = "Symmetric" | |
210 | p.Size = Vector3.new(1, 1, 1) | |
211 | p.BrickColor = GC | |
212 | p.CanCollide = false | |
213 | p.Locked = true | |
214 | p.TopSurface = 0 | |
215 | p.BottomSurface = 0 | |
216 | p.Parent = model | |
217 | local m = Instance.new("BlockMesh") | |
218 | m.Scale = Vector3.new(0.261, 0.42, 0.7) | |
219 | m.Parent = p | |
220 | local w = Instance.new("Weld") | |
221 | w.Part0 = p | |
222 | w.Part1 = pm | |
223 | w.C0 = CFrame.new(0, -0.022, -0.4) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0) | |
224 | w.C1 = CFrame.new() | |
225 | w.Parent = p | |
226 | local p = Instance.new("Part") | |
227 | p.Name = "TriggerGuard" | |
228 | p.formFactor = "Symmetric" | |
229 | p.Size = Vector3.new(1, 1, 1) | |
230 | p.BrickColor = GC | |
231 | p.CanCollide = false | |
232 | p.Locked = true | |
233 | p.TopSurface = 0 | |
234 | p.BottomSurface = 0 | |
235 | p.Parent = model | |
236 | local m = Instance.new("SpecialMesh") | |
237 | m.MeshType = "FileMesh" | |
238 | m.MeshId = "http://www.roblox.com/asset/?id=3270017" | |
239 | m.Scale = Vector3.new(0.3, 0.3, 0.8) | |
240 | m.Parent = p | |
241 | local w = Instance.new("Weld") | |
242 | w.Part0 = p | |
243 | w.Part1 = pm | |
244 | w.C0 = CFrame.new(-0.21, 0.16, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
245 | w.C1 = CFrame.new() | |
246 | w.Parent = p | |
247 | local p = Instance.new("Part") | |
248 | p.Name = "Trigger" | |
249 | p.formFactor = "Symmetric" | |
250 | p.Size = Vector3.new(1, 1, 1) | |
251 | p.BrickColor = GC | |
252 | p.CanCollide = false | |
253 | p.Locked = true | |
254 | p.TopSurface = 0 | |
255 | p.BottomSurface = 0 | |
256 | p.Parent = model | |
257 | local m = Instance.new("BlockMesh") | |
258 | m.Scale = Vector3.new(0.1, 0.4, 0.16) | |
259 | m.Parent = p | |
260 | local w = Instance.new("Weld") | |
261 | w.Part0 = p | |
262 | w.Part1 = pm | |
263 | w.C0 = CFrame.new(0, 0.04, -0.22) | |
264 | w.C1 = CFrame.new() | |
265 | w.Parent = p | |
266 | local p = Instance.new("Part") | |
267 | p.Name = "Base" | |
268 | p.CanCollide = false | |
269 | p.formFactor = "Symmetric" | |
270 | p.Size = Vector3.new(1, 1, 1) | |
271 | p.BrickColor = GC | |
272 | p.Locked = true | |
273 | p.TopSurface = 0 | |
274 | p.BottomSurface = 0 | |
275 | p.Parent = model | |
276 | local m = Instance.new("BlockMesh") | |
277 | m.Scale = Vector3.new(0.26, 0.72, 0.1) | |
278 | m.Parent = p | |
279 | local w = Instance.new("Weld") | |
280 | w.Part0 = p | |
281 | w.Part1 = pm | |
282 | w.C0 = CFrame.new(0, 0.09, -0.1) | |
283 | w.C1 = CFrame.new() | |
284 | w.Parent = p | |
285 | local p = Instance.new("Part") | |
286 | p.Name = "Body" | |
287 | p.formFactor = "Symmetric" | |
288 | p.Size = Vector3.new(1, 1, 1) | |
289 | p.BrickColor = GC | |
290 | p.CanCollide = false | |
291 | p.Locked = true | |
292 | p.TopSurface = 0 | |
293 | p.BottomSurface = 0 | |
294 | p.Parent = model | |
295 | local m = Instance.new("BlockMesh") | |
296 | m.Scale = Vector3.new(0.26, 0.1, 0.28) | |
297 | m.Parent = p | |
298 | local w = Instance.new("Weld") | |
299 | w.Part0 = p | |
300 | w.Part1 = pm | |
301 | w.C0 = CFrame.new(0, 0, 0.03) | |
302 | w.C1 = CFrame.new() | |
303 | w.Parent = p | |
304 | local p = Instance.new("Part") | |
305 | p.Name = "Body" | |
306 | p.formFactor = "Symmetric" | |
307 | p.Size = Vector3.new(1, 1, 1) | |
308 | p.BrickColor = GC | |
309 | p.CanCollide = false | |
310 | p.Locked = true | |
311 | p.TopSurface = 0 | |
312 | p.BottomSurface = 0 | |
313 | p.Parent = model | |
314 | local m = Instance.new("SpecialMesh") | |
315 | m.MeshType = "Wedge" | |
316 | m.Scale = Vector3.new(0.086, 0.2, 0.15) | |
317 | m.Parent = p | |
318 | local w = Instance.new("Weld") | |
319 | w.Part0 = p | |
320 | w.Part1 = pm | |
321 | w.C0 = CFrame.new(0.086, -0.15, 0.08) | |
322 | w.C1 = CFrame.new() | |
323 | w.Parent = p | |
324 | local p = Instance.new("Part") | |
325 | p.Name = "Body" | |
326 | p.formFactor = "Symmetric" | |
327 | p.Size = Vector3.new(1, 1, 1) | |
328 | p.BrickColor = GC | |
329 | p.CanCollide = false | |
330 | p.Locked = true | |
331 | p.TopSurface = 0 | |
332 | p.BottomSurface = 0 | |
333 | p.Parent = model | |
334 | local m = Instance.new("SpecialMesh") | |
335 | m.MeshType = "Wedge" | |
336 | m.Scale = Vector3.new(0.086, 0.2, 0.15) | |
337 | m.Parent = p | |
338 | local w = Instance.new("Weld") | |
339 | w.Part0 = p | |
340 | w.Part1 = pm | |
341 | w.C0 = CFrame.new(-0.086, -0.15, 0.08) | |
342 | w.C1 = CFrame.new() | |
343 | w.Parent = p | |
344 | local p = Instance.new("Part") | |
345 | p.Name = "Body" | |
346 | p.formFactor = "Symmetric" | |
347 | p.Size = Vector3.new(1, 1, 1) | |
348 | p.BrickColor = GC | |
349 | p.CanCollide = false | |
350 | p.Locked = true | |
351 | p.TopSurface = 0 | |
352 | p.BottomSurface = 0 | |
353 | p.Parent = model | |
354 | local m = Instance.new("SpecialMesh") | |
355 | m.MeshType = "Wedge" | |
356 | m.Scale = Vector3.new(0.086, 0.2, 0.075) | |
357 | m.Parent = p | |
358 | local w = Instance.new("Weld") | |
359 | w.Part0 = p | |
360 | w.Part1 = pm | |
361 | w.C0 = CFrame.new(0, -0.15, 0.02) | |
362 | w.C1 = CFrame.new() | |
363 | w.Parent = p | |
364 | local p = Instance.new("Part") | |
365 | p.Name = "Hammer" | |
366 | p.formFactor = "Symmetric" | |
367 | p.Size = Vector3.new(1, 1, 1) | |
368 | p.BrickColor = MC | |
369 | p.Reflectance = MR | |
370 | p.CanCollide = false | |
371 | p.Locked = true | |
372 | p.TopSurface = 0 | |
373 | p.BottomSurface = 0 | |
374 | p.Parent = model | |
375 | local m = Instance.new("BlockMesh") | |
376 | m.Scale = Vector3.new(0.086, 0.1, 0.3) | |
377 | m.Parent = p | |
378 | local w = Instance.new("Weld") | |
379 | w.Part0 = p | |
380 | w.Part1 = pm | |
381 | if Hammer == false then | |
382 | w.C0 = CFrame.new(0, -0.1, 0.08) | |
383 | else | |
384 | w.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0) | |
385 | end | |
386 | w.C1 = CFrame.new() | |
387 | w.Parent = p | |
388 | local p = Instance.new("Part") | |
389 | p.Name = "Body" | |
390 | p.formFactor = "Symmetric" | |
391 | p.Size = Vector3.new(1, 1, 1) | |
392 | p.BrickColor = GC | |
393 | p.CanCollide = false | |
394 | p.Locked = true | |
395 | p.TopSurface = 0 | |
396 | p.BottomSurface = 0 | |
397 | p.Parent = model | |
398 | local m = Instance.new("BlockMesh") | |
399 | m.Scale = Vector3.new(0.26, 0.22, 0.1) | |
400 | m.Parent = p | |
401 | local w = Instance.new("Weld") | |
402 | w.Part0 = p | |
403 | w.Part1 = pm | |
404 | w.C0 = CFrame.new(0, -0.16, -0.02) | |
405 | w.C1 = CFrame.new() | |
406 | w.Parent = p | |
407 | local pv1 = Instance.new("Part") | |
408 | pv1.Name = "Pivot1" | |
409 | pv1.formFactor = "Symmetric" | |
410 | pv1.Size = Vector3.new(1, 1, 1) | |
411 | pv1.BrickColor = MC | |
412 | pv1.Reflectance = MR | |
413 | pv1.CanCollide = false | |
414 | pv1.Locked = true | |
415 | pv1.TopSurface = 0 | |
416 | pv1.BottomSurface = 0 | |
417 | pv1.Parent = model | |
418 | local m = Instance.new("CylinderMesh") | |
419 | m.Scale = Vector3.new(0.15, 0.261, 0.15) | |
420 | m.Parent = pv1 | |
421 | local w = Instance.new("Weld") | |
422 | w.Part0 = pv1 | |
423 | w.Part1 = pm | |
424 | w.C0 = CFrame.new(-0.45, 0, -0.04) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90)) | |
425 | w.C1 = CFrame.new() | |
426 | w.Parent = pv1 | |
427 | local pv = Instance.new("Part") | |
428 | pv.Name = "Pivot" | |
429 | pv.formFactor = "Symmetric" | |
430 | pv.Size = Vector3.new(1, 1, 1) | |
431 | pv.BrickColor = BrickColor.new("Lime green") | |
432 | pv.Reflectance = MR | |
433 | pv.CanCollide = false | |
434 | pv.Locked = true | |
435 | pv.TopSurface = 0 | |
436 | pv.BottomSurface = 0 | |
437 | pv.Parent = model | |
438 | local m = Instance.new("CylinderMesh") | |
439 | m.Scale = Vector3.new(0.1, 0.27, 0.1) | |
440 | m.Parent = pv | |
441 | local w = Instance.new("Weld") | |
442 | w.Part0 = pv | |
443 | w.Part1 = pv1 | |
444 | w.C0 = CFrame.new(0, 0, 0) | |
445 | w.C1 = CFrame.new() | |
446 | w.Parent = pv | |
447 | local p = Instance.new("Part") | |
448 | p.Name = "Barrel1" | |
449 | p.formFactor = "Symmetric" | |
450 | p.Size = Vector3.new(1, 1, 1) | |
451 | p.BrickColor = MC | |
452 | p.Reflectance = MR | |
453 | p.CanCollide = false | |
454 | p.Locked = true | |
455 | p.TopSurface = 0 | |
456 | p.BottomSurface = 0 | |
457 | p.Parent = model | |
458 | local m = Instance.new("BlockMesh") | |
459 | m.Scale = Vector3.new(0.15, 0.26, 0.28) | |
460 | m.Parent = p | |
461 | local w = Instance.new("Weld") | |
462 | w.Part0 = p | |
463 | w.Part1 = pv | |
464 | w.C0 = CFrame.new(0, 0, 0.14) | |
465 | w.C1 = CFrame.new() | |
466 | w.Parent = p | |
467 | local p = Instance.new("Part") | |
468 | p.Name = "Barrel2" | |
469 | p.formFactor = "Symmetric" | |
470 | p.Size = Vector3.new(1, 1, 1) | |
471 | p.BrickColor = MC | |
472 | p.Reflectance = MR | |
473 | p.CanCollide = false | |
474 | p.Locked = true | |
475 | p.TopSurface = 0 | |
476 | p.BottomSurface = 0 | |
477 | p.Parent = model | |
478 | local m = Instance.new("BlockMesh") | |
479 | m.Scale = Vector3.new(0.6, 0.2, 0.28) | |
480 | m.Parent = p | |
481 | local w = Instance.new("Weld") | |
482 | w.Part0 = p | |
483 | w.Part1 = pv | |
484 | w.C0 = CFrame.new(-0.36, 0, 0.14) | |
485 | w.C1 = CFrame.new() | |
486 | w.Parent = p | |
487 | local p = Instance.new("Part") | |
488 | p.Name = "Barrel3" | |
489 | p.formFactor = "Symmetric" | |
490 | p.Size = Vector3.new(1, 1, 1) | |
491 | p.BrickColor = MC | |
492 | p.Reflectance = MR | |
493 | p.CanCollide = false | |
494 | p.Locked = true | |
495 | p.TopSurface = 0 | |
496 | p.BottomSurface = 0 | |
497 | p.Parent = model | |
498 | local m = Instance.new("BlockMesh") | |
499 | m.Scale = Vector3.new(0.6, 0.26, 0.22) | |
500 | m.Parent = p | |
501 | local w = Instance.new("Weld") | |
502 | w.Part0 = p | |
503 | w.Part1 = pv | |
504 | w.C0 = CFrame.new(-0.36, 0, 0.14) | |
505 | w.C1 = CFrame.new() | |
506 | w.Parent = p | |
507 | local p = Instance.new("Part") | |
508 | p.Name = "Hole" | |
509 | p.formFactor = "Symmetric" | |
510 | p.Size = Vector3.new(1, 1, 1) | |
511 | p.BrickColor = BrickColor.new("New Yeller") | |
512 | p.Reflectance = 0 | |
513 | p.CanCollide = false | |
514 | p.Locked = true | |
515 | p.TopSurface = 0 | |
516 | p.BottomSurface = 0 | |
517 | p.Parent = model | |
518 | local m = Instance.new("CylinderMesh") | |
519 | m.Scale = Vector3.new(0.1, 0.602, 0.1) | |
520 | m.Parent = p | |
521 | local w = Instance.new("Weld") | |
522 | w.Part0 = p | |
523 | w.Part1 = pv | |
524 | w.C0 = CFrame.new(0, -0.36, 0.18) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90)) | |
525 | w.C1 = CFrame.new() | |
526 | w.Parent = p | |
527 | local p = Instance.new("Part") | |
528 | p.Name = "Top" | |
529 | p.formFactor = "Symmetric" | |
530 | p.Size = Vector3.new(1, 1, 1) | |
531 | p.BrickColor = MC | |
532 | p.Reflectance = MR | |
533 | p.CanCollide = false | |
534 | p.Locked = true | |
535 | p.TopSurface = 0 | |
536 | p.BottomSurface = 0 | |
537 | p.Parent = model | |
538 | local m = Instance.new("BlockMesh") | |
539 | m.Scale = Vector3.new(0.5, 0.26, 0.08) | |
540 | m.Parent = p | |
541 | local w = Instance.new("Weld") | |
542 | w.Part0 = p | |
543 | w.Part1 = pv | |
544 | w.C0 = CFrame.new(0.25, 0, 0.24) | |
545 | w.C1 = CFrame.new() | |
546 | w.Parent = p | |
547 | if Scoped == true then | |
548 | canZoom = true | |
549 | local p = Instance.new("Part") | |
550 | p.Name = "Scope" | |
551 | p.formFactor = "Symmetric" | |
552 | p.Size = Vector3.new(1, 1, 1) | |
553 | p.BrickColor = GC | |
554 | p.CanCollide = false | |
555 | p.Locked = true | |
556 | p.TopSurface = 0 | |
557 | p.BottomSurface = 0 | |
558 | p.Parent = model | |
559 | local m = Instance.new("CylinderMesh") | |
560 | m.Scale = Vector3.new(0.24, 0.5, 0.24) | |
561 | m.Parent = p | |
562 | local w = Instance.new("Weld") | |
563 | w.Part0 = p | |
564 | w.Part1 = pv | |
565 | w.C0 = CFrame.new(0, -0.2, 0.38) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90)) | |
566 | w.C1 = CFrame.new() | |
567 | w.Parent = p | |
568 | local p = Instance.new("Part") | |
569 | p.Name = "Scope" | |
570 | p.formFactor = "Symmetric" | |
571 | p.Size = Vector3.new(1, 1, 1) | |
572 | p.BrickColor = BrickColor.new("White") | |
573 | p.Reflectance = 0.5 | |
574 | p.CanCollide = false | |
575 | p.Locked = true | |
576 | p.TopSurface = 0 | |
577 | p.BottomSurface = 0 | |
578 | p.Parent = model | |
579 | local m = Instance.new("CylinderMesh") | |
580 | m.Scale = Vector3.new(0.23, 0.503, 0.23) | |
581 | m.Parent = p | |
582 | local w = Instance.new("Weld") | |
583 | w.Part0 = p | |
584 | w.Part1 = pv | |
585 | w.C0 = CFrame.new(0, -0.2, 0.38) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90)) | |
586 | w.C1 = CFrame.new() | |
587 | w.Parent = p | |
588 | else end | |
589 | local p = Instance.new("Part") | |
590 | p.Name = "RearSight" | |
591 | p.formFactor = "Symmetric" | |
592 | p.Size = Vector3.new(1, 1, 1) | |
593 | p.BrickColor = MC | |
594 | p.Reflectance = MR | |
595 | p.CanCollide = false | |
596 | p.Locked = true | |
597 | p.TopSurface = 0 | |
598 | p.BottomSurface = 0 | |
599 | p.Parent = model | |
600 | local m = Instance.new("BlockMesh") | |
601 | m.Scale = Vector3.new(0.1, 0.08, 0.08) | |
602 | m.Parent = p | |
603 | local w = Instance.new("Weld") | |
604 | w.Part0 = p | |
605 | w.Part1 = pv | |
606 | w.C0 = CFrame.new(0.44, 0.08, 0.28) | |
607 | w.C1 = CFrame.new() | |
608 | w.Parent = p | |
609 | local p = Instance.new("Part") | |
610 | p.Name = "RearSight" | |
611 | p.formFactor = "Symmetric" | |
612 | p.Size = Vector3.new(1, 1, 1) | |
613 | p.BrickColor = MC | |
614 | p.Reflectance = MR | |
615 | p.CanCollide = false | |
616 | p.Locked = true | |
617 | p.TopSurface = 0 | |
618 | p.BottomSurface = 0 | |
619 | p.Parent = model | |
620 | local m = Instance.new("BlockMesh") | |
621 | m.Scale = Vector3.new(0.1, 0.08, 0.08) | |
622 | m.Parent = p | |
623 | local w = Instance.new("Weld") | |
624 | w.Part0 = p | |
625 | w.Part1 = pv | |
626 | w.C0 = CFrame.new(0.44, -0.08, 0.28) | |
627 | w.C1 = CFrame.new() | |
628 | w.Parent = p | |
629 | local p = Instance.new("Part") | |
630 | p.Name = "FrontSight" | |
631 | p.formFactor = "Symmetric" | |
632 | p.Size = Vector3.new(1, 1, 1) | |
633 | p.BrickColor = MC | |
634 | p.Reflectance = MR | |
635 | p.CanCollide = false | |
636 | p.Locked = true | |
637 | p.TopSurface = 0 | |
638 | p.BottomSurface = 0 | |
639 | p.Parent = model | |
640 | local m = Instance.new("BlockMesh") | |
641 | m.Scale = Vector3.new(0.1, 0.08, 0.08) | |
642 | m.Parent = p | |
643 | local w = Instance.new("Weld") | |
644 | w.Part0 = p | |
645 | w.Part1 = pv | |
646 | w.C0 = CFrame.new(-0.58, 0, 0.28) | |
647 | w.C1 = CFrame.new() | |
648 | w.Parent = p | |
649 | local p = Instance.new("Part") | |
650 | p.Name = "Cylinder" | |
651 | p.formFactor = "Symmetric" | |
652 | p.Size = Vector3.new(1, 1, 1) | |
653 | p.BrickColor = MC | |
654 | p.Reflectance = MR | |
655 | p.CanCollide = false | |
656 | p.Locked = true | |
657 | p.TopSurface = 0 | |
658 | p.BottomSurface = 0 | |
659 | p.Parent = model | |
660 | local m = Instance.new("CylinderMesh") | |
661 | m.Scale = Vector3.new(0.29, 0.32, 0.29) | |
662 | m.Parent = p | |
663 | local w = Instance.new("Weld") | |
664 | w.Part0 = p | |
665 | w.Part1 = pv | |
666 | w.C0 = CFrame.new(0, 0.23, 0.1) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90)) | |
667 | w.C1 = CFrame.new() | |
668 | w.Parent = p | |
669 | local p = Instance.new("Part") | |
670 | p.Name = "Pin" | |
671 | p.formFactor = "Symmetric" | |
672 | p.Size = Vector3.new(1, 1, 1) | |
673 | p.BrickColor = BrickColor.new("New Yeller") | |
674 | p.Reflectance = MR | |
675 | p.CanCollide = false | |
676 | p.Locked = true | |
677 | p.TopSurface = 0 | |
678 | p.BottomSurface = 0 | |
679 | p.Parent = model | |
680 | local m = Instance.new("CylinderMesh") | |
681 | m.Scale = Vector3.new(0.06, 0.46, 0.06) | |
682 | m.Parent = p | |
683 | local w = Instance.new("Weld") | |
684 | w.Part0 = p | |
685 | w.Part1 = pv | |
686 | w.C0 = CFrame.new(0, 0.23, 0.1) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90)) | |
687 | w.C1 = CFrame.new() | |
688 | w.Parent = p | |
689 | local p = Instance.new("Part") | |
690 | if silenced == false then | |
691 | p.Name = "Muzzle" | |
692 | else | |
693 | p.Name = "Muzzle 2" | |
694 | end | |
695 | p.formFactor = "Symmetric" | |
696 | p.Size = Vector3.new(1, 1, 1) | |
697 | p.BrickColor = BrickColor.new("Lime green") | |
698 | p.Reflectance = 0.06 | |
699 | p.CanCollide = false | |
700 | p.Transparency = 1 | |
701 | p.Locked = true | |
702 | p.TopSurface = 0 | |
703 | p.BottomSurface = 0 | |
704 | p.Parent = model | |
705 | local m = Instance.new("CylinderMesh") | |
706 | m.Scale = Vector3.new(0.5, 0.1, 0.5) | |
707 | m.Offset = Vector3.new(0, 0, 0) | |
708 | m.Parent = p | |
709 | local w = Instance.new("Weld") | |
710 | w.Part0 = p | |
711 | w.Part1 = pv | |
712 | w.C0 = CFrame.new(0, 0.8, 0.18) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-90)) | |
713 | w.C1 = CFrame.new() | |
714 | w.Parent = p | |
715 | local s = Instance.new("Smoke") | |
716 | s.Enabled = false | |
717 | s.Name = "Smoke" | |
718 | s.RiseVelocity = -5 | |
719 | s.Opacity = 0.3 | |
720 | s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225) | |
721 | s.Size = 1 | |
722 | s.Parent = p | |
723 | local f = Instance.new("Fire") | |
724 | f.Enabled = false | |
725 | f.Name = "Fire" | |
726 | f.Heat = -35 | |
727 | f.Size = 1 | |
728 | f.Parent = p | |
729 | return model | |
730 | end | |
731 | ||
732 | ||
733 | function removeParts(format) | |
734 | if format == "RightHand" then | |
735 | pcall(function() Player.Character[Name]:Remove() end) | |
736 | elseif format == "LeftHand" then | |
737 | pcall(function() Player.Character[Name.. " (Left)"]:Remove() end) | |
738 | elseif format == "RightHolster" then | |
739 | pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end) | |
740 | elseif format == "LeftHolster" then | |
741 | pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end) | |
742 | end | |
743 | end | |
744 | ||
745 | ||
746 | function SetAngle(Joint, Angle, Character) | |
747 | if Character == nil then return false end | |
748 | local Joints = { | |
749 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
750 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
751 | Character.Torso:FindFirstChild("Right Hip 2"), | |
752 | Character.Torso:FindFirstChild("Left Hip 2") | |
753 | } | |
754 | if Joints[Joint] == nil then return false end | |
755 | if Joint == 1 or Joint == 3 then | |
756 | Joints[Joint].DesiredAngle = Angle | |
757 | end | |
758 | if Joint == 2 or Joint == 4 then | |
759 | Joints[Joint].DesiredAngle = -Angle | |
760 | end | |
761 | end | |
762 | ||
763 | ||
764 | function ForceAngle(Joint, Angle, Character) | |
765 | if Character == nil then return false end | |
766 | local Joints = { | |
767 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
768 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
769 | Character.Torso:FindFirstChild("Right Hip 2"), | |
770 | Character.Torso:FindFirstChild("Left Hip 2") | |
771 | } | |
772 | if Joints[Joint] == nil then return false end | |
773 | if Joint == 1 or Joint == 3 then | |
774 | Joints[Joint].DesiredAngle = Angle | |
775 | Joints[Joint].CurrentAngle = Angle | |
776 | end | |
777 | if Joint == 2 or Joint == 4 then | |
778 | Joints[Joint].DesiredAngle = -Angle | |
779 | Joints[Joint].CurrentAngle = -Angle | |
780 | end | |
781 | end | |
782 | ||
783 | ||
784 | function SetSpeed(Joint, Speed, Character) | |
785 | if Character == nil then return false end | |
786 | local Joints = { | |
787 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
788 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
789 | Character.Torso:FindFirstChild("Right Hip 2"), | |
790 | Character.Torso:FindFirstChild("Left Hip 2") | |
791 | } | |
792 | if Joints[Joint] == nil then return false end | |
793 | Joints[Joint].MaxVelocity = Speed | |
794 | end | |
795 | ||
796 | ||
797 | function DisableLimb(Limb, Character) | |
798 | if Character == nil then return false end | |
799 | if Character:FindFirstChild("Torso") == nil then return false end | |
800 | local Joints = { | |
801 | Character.Torso:FindFirstChild("Right Shoulder"), | |
802 | Character.Torso:FindFirstChild("Left Shoulder"), | |
803 | Character.Torso:FindFirstChild("Right Hip"), | |
804 | Character.Torso:FindFirstChild("Left Hip") | |
805 | } | |
806 | local Limbs = { | |
807 | Character:FindFirstChild("Right Arm"), | |
808 | Character:FindFirstChild("Left Arm"), | |
809 | Character:FindFirstChild("Right Leg"), | |
810 | Character:FindFirstChild("Left Leg") | |
811 | } | |
812 | if Joints[Limb] == nil then return false end | |
813 | if Limbs[Limb] == nil then return false end | |
814 | local Joint = Instance.new("Motor") | |
815 | Joint.Parent = Character.Torso | |
816 | Joint.Part0 = Character.Torso | |
817 | Joint.Part1 = Limbs[Limb] | |
818 | if Limb == 1 then | |
819 | Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
820 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
821 | Joint.Name = "Right Shoulder 2" | |
822 | elseif Limb == 2 then | |
823 | Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
824 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
825 | Joint.Name = "Left Shoulder 2" | |
826 | elseif Limb == 3 then | |
827 | Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
828 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
829 | Joint.Name = "Right Hip 2" | |
830 | elseif Limb == 4 then | |
831 | Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
832 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
833 | Joint.Name = "Left Hip 2" | |
834 | end | |
835 | Joint.MaxVelocity = Joints[Limb].MaxVelocity | |
836 | Joint.CurrentAngle = Joints[Limb].CurrentAngle | |
837 | Joint.DesiredAngle = Joints[Limb].DesiredAngle | |
838 | Joints[Limb]:Remove() | |
839 | end | |
840 | ||
841 | ||
842 | function ResetLimbCFrame(Limb, Character) | |
843 | if Character == nil then return false end | |
844 | if Character.Parent == nil then return false end | |
845 | if Character:FindFirstChild("Torso") == nil then return false end | |
846 | local Joints = { | |
847 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
848 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
849 | Character.Torso:FindFirstChild("Right Hip 2"), | |
850 | Character.Torso:FindFirstChild("Left Hip 2") | |
851 | } | |
852 | local Limbs = { | |
853 | Character:FindFirstChild("Right Arm"), | |
854 | Character:FindFirstChild("Left Arm"), | |
855 | Character:FindFirstChild("Right Leg"), | |
856 | Character:FindFirstChild("Left Leg") | |
857 | } | |
858 | if Joints[Limb] == nil then return false end | |
859 | if Limbs[Limb] == nil then return false end | |
860 | if Limb == 1 then | |
861 | Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
862 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
863 | elseif Limb == 2 then | |
864 | Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
865 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
866 | elseif Limb == 3 then | |
867 | Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
868 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
869 | elseif Limb == 4 then | |
870 | Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
871 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
872 | end | |
873 | end | |
874 | ||
875 | ||
876 | function EnableLimb(Limb, Character) | |
877 | if Character == nil then return false end | |
878 | if Character:FindFirstChild("Torso") == nil then return false end | |
879 | local Joints = { | |
880 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
881 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
882 | Character.Torso:FindFirstChild("Right Hip 2"), | |
883 | Character.Torso:FindFirstChild("Left Hip 2") | |
884 | } | |
885 | local Limbs = { | |
886 | Character:FindFirstChild("Right Arm"), | |
887 | Character:FindFirstChild("Left Arm"), | |
888 | Character:FindFirstChild("Right Leg"), | |
889 | Character:FindFirstChild("Left Leg") | |
890 | } | |
891 | if Joints[Limb] == nil then return false end | |
892 | if Limbs[Limb] == nil then return false end | |
893 | if Limb == 1 then | |
894 | Joints[Limb].Name = "Right Shoulder" | |
895 | elseif Limb == 2 then | |
896 | Joints[Limb].Name = "Left Shoulder" | |
897 | elseif Limb == 3 then | |
898 | Joints[Limb].Name = "Right Hip" | |
899 | elseif Limb == 4 then | |
900 | Joints[Limb].Name = "Left Hip" | |
901 | end | |
902 | Animate = Character:FindFirstChild("Animate") | |
903 | if Animate == nil then return false end | |
904 | Animate = Animate:Clone() | |
905 | Character.Animate:Remove() | |
906 | Animate.Parent = Character | |
907 | end | |
908 | ||
909 | ||
910 | function playAnimation(format, mouse) | |
911 | if format == "equip" then | |
912 | Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove() | |
913 | local w = Instance.new("Weld") | |
914 | w.Part0 = Player.Character[Name.. " (Holstered)"].Handle | |
915 | w.Part1 = Player.Character:FindFirstChild("Right Arm") | |
916 | w.C0 = CFrame.new(0, 1.2, 0.7) | |
917 | w.C1 = CFrame.new() | |
918 | w.Parent = Player.Character[Name.. " (Holstered)"].Handle | |
919 | for i = 0.01, 1, 0.1 do | |
920 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
921 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
922 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
923 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.55 * i) + (1.5 * (1 - i)), 0.75 * i, 0.35 * i) * CFrame.fromEulerAnglesXYZ(math.rad(315 + ((1 - i) * 50)), 0, math.rad(-90) * i) | |
924 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
925 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0) | |
926 | wait() | |
927 | else return false end | |
928 | else return false end | |
929 | end | |
930 | return playAnimation("hold") | |
931 | end | |
932 | if format == "rightEquip" then | |
933 | Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove() | |
934 | local w = Instance.new("Weld") | |
935 | w.Part0 = Player.Character[Name.. " (Holstered)"].Handle | |
936 | w.Part1 = Player.Character:FindFirstChild("Right Arm") | |
937 | w.C0 = CFrame.new(0, 1.2, 0.7) | |
938 | w.C1 = CFrame.new() | |
939 | w.Parent = Player.Character[Name.. " (Holstered)"].Handle | |
940 | for i = 0.01, 1, 0.1 do | |
941 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
942 | if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
943 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
944 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0) | |
945 | wait() | |
946 | else return false end | |
947 | else return false end | |
948 | end | |
949 | return playAnimation("rightHold") | |
950 | end | |
951 | if format == "leftEquip" then | |
952 | Player.Character[Name.. " (Holstered, Left)"].Handle.Weld:Remove() | |
953 | local w = Instance.new("Weld") | |
954 | w.Part0 = Player.Character[Name.. " (Holstered, Left)"].Handle | |
955 | w.Part1 = Player.Character:FindFirstChild("Left Arm") | |
956 | w.C0 = CFrame.new(0, 1.2, 0.7) | |
957 | w.C1 = CFrame.new() | |
958 | w.Parent = Player.Character[Name.. " (Holstered, Left)"].Handle | |
959 | for i = 0.01, 1, 0.1 do | |
960 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
961 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then | |
962 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
963 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((1 * i) + (1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(5 * i), 0) | |
964 | wait() | |
965 | else return false end | |
966 | else return false end | |
967 | end | |
968 | return playAnimation("leftHold") | |
969 | end | |
970 | if format == "unequip" then | |
971 | for i = 1, 0.01, -0.1 do | |
972 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
973 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
974 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
975 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.55 * i) + (1.5 * (1 - i)), 0.75 * i, 0.35 * i) * CFrame.fromEulerAnglesXYZ(math.rad(315 + ((1 - i) * 50)), 0, math.rad(-90) * i) | |
976 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
977 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0) | |
978 | wait() | |
979 | else return false end | |
980 | else return false end | |
981 | end | |
982 | return true | |
983 | end | |
984 | if format == "leftUnequip" then | |
985 | for i = 1, 0.01, -0.1 do | |
986 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
987 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then | |
988 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
989 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((1 * i) + (1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(5 * i), 0) | |
990 | wait() | |
991 | else return false end | |
992 | else return false end | |
993 | end | |
994 | return true | |
995 | end | |
996 | if format == "rightUnequip" then | |
997 | for i = 1, 0.01, -0.1 do | |
998 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
999 | if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1000 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1001 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0) | |
1002 | wait() | |
1003 | else return false end | |
1004 | else return false end | |
1005 | end | |
1006 | return true | |
1007 | end | |
1008 | if format == "hold" then | |
1009 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1010 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1011 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1012 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), 0, math.rad(-90)) | |
1013 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1014 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0) | |
1015 | else return false end | |
1016 | else return false end | |
1017 | end | |
1018 | if format == "rightHold" then | |
1019 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1020 | if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1021 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1022 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(-10)) | |
1023 | else return false end | |
1024 | else return false end | |
1025 | end | |
1026 | if format == "leftHold" then | |
1027 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1028 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then | |
1029 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1030 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(10)) | |
1031 | else return false end | |
1032 | else return false end | |
1033 | end | |
1034 | if format == "reload" then | |
1035 | Player.Character[Name].Handle.Empty:Play() | |
1036 | for i = 0, 25, 7.5 do | |
1037 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1038 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1039 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1040 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1041 | wait() | |
1042 | else return false end | |
1043 | else return false end | |
1044 | end | |
1045 | for i = 25, 0, -7.5 do | |
1046 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1047 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1048 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1049 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1050 | wait() | |
1051 | else return false end | |
1052 | else return false end | |
1053 | end | |
1054 | coroutine.wrap(function() | |
1055 | for i = 0, 90, 15 do | |
1056 | pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) end) | |
1057 | wait() | |
1058 | end | |
1059 | pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) end) | |
1060 | for i = 1, Loaded do | |
1061 | Player.Character[Name].Handle.Switch:Play() | |
1062 | makeShell(Player.Character[Name]:FindFirstChild("Cylinder")) | |
1063 | Loaded = Loaded - 1 | |
1064 | if magazine.Value ~= 0 then | |
1065 | magazine.Value = magazine.Value - 1 | |
1066 | updateGui() | |
1067 | end | |
1068 | wait(0.02) | |
1069 | end | |
1070 | end)() | |
1071 | CamShake(15, 50000) | |
1072 | Player.Character[Name].Handle.Release:Play() | |
1073 | --[[for i = 25, 0, -5 do | |
1074 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1075 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1076 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1077 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + ((25 - i) / 30), 0.5, 0.6 + ((25 - i) / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), math.rad((25 * 2) - (i * 2))) | |
1078 | wait() | |
1079 | else return false end | |
1080 | else return false end | |
1081 | end | |
1082 | for i = 25, 0, -5 do | |
1083 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1084 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1085 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1086 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + (i / 30), 0.5, 0.6 + (i / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), math.rad((25 * 2) - ((25 - i) * 2))) | |
1087 | wait() | |
1088 | else return false end | |
1089 | else return false end | |
1090 | end | |
1091 | wait(0.18)--]] | |
1092 | for i = 0, 35, 5 do | |
1093 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1094 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1095 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1096 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, -0.4, 0.3) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), 0) | |
1097 | wait() | |
1098 | else return false end | |
1099 | else return false end | |
1100 | end | |
1101 | wait(0.2) | |
1102 | if ammo.Value >= 6 then | |
1103 | for i = 1, 6 do | |
1104 | for i = 5, 0, -1 do | |
1105 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1106 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1107 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1108 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.85, 0.84) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90)) | |
1109 | wait() | |
1110 | else return false end | |
1111 | else return false end | |
1112 | end | |
1113 | Player.Character[Name].Handle.Reload:Play() | |
1114 | ammo.Value = ammo.Value - 1 | |
1115 | magazine.Value = magazine.Value + 1 | |
1116 | Loaded = Loaded + 1 | |
1117 | updateGui() | |
1118 | wait(0.1) | |
1119 | end | |
1120 | elseif ammo.Value <= 6 then | |
1121 | for i = 1, ammo.Value do | |
1122 | for i = 5, 0, -1 do | |
1123 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1124 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1125 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1126 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.85, 0.84) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90)) | |
1127 | wait() | |
1128 | else return false end | |
1129 | else return false end | |
1130 | end | |
1131 | Player.Character[Name].Handle.Reload:Play() | |
1132 | ammo.Value = ammo.Value - 1 | |
1133 | magazine.Value = magazine.Value + 1 | |
1134 | Loaded = Loaded + 1 | |
1135 | updateGui() | |
1136 | wait(0.1) | |
1137 | end | |
1138 | else end | |
1139 | wait(0.04) | |
1140 | coroutine.wrap(function() | |
1141 | for i = 1, 0, -0.25 do | |
1142 | pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i * 90), 0) end) | |
1143 | wait() | |
1144 | end | |
1145 | pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0) end) | |
1146 | end)() | |
1147 | CamShake(15, 50000) | |
1148 | Player.Character[Name].Handle.Release:Play() | |
1149 | for i = 0, 25, 7.5 do | |
1150 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1151 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1152 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1153 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1154 | wait() | |
1155 | else return false end | |
1156 | else return false end | |
1157 | end | |
1158 | for i = 25, 0, -7.5 do | |
1159 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1160 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1161 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1162 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1163 | wait() | |
1164 | else return false end | |
1165 | else return false end | |
1166 | end | |
1167 | playAnimation("hold") | |
1168 | return true | |
1169 | end | |
1170 | if format == "reloadDual" then | |
1171 | for i = 0, 25, 7.5 do | |
1172 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1173 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1174 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1175 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0) | |
1176 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1177 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1178 | wait() | |
1179 | else return false end | |
1180 | else return false end | |
1181 | end | |
1182 | CamShake(1, 40000) | |
1183 | Player.Character[Name].Handle.Release:Play() | |
1184 | coroutine.wrap(function() | |
1185 | for i = 0, 90, 15 do | |
1186 | pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) end) | |
1187 | pcall(function() Player.Character[Name.. " (Left)"].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) end) | |
1188 | wait() | |
1189 | end | |
1190 | pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) end) | |
1191 | pcall(function() Player.Character[Name.. " (Left)"].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) end) | |
1192 | end)() | |
1193 | for i = 0, 25, 7.5 do | |
1194 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1195 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1196 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1197 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0) | |
1198 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1199 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1200 | wait() | |
1201 | else return false end | |
1202 | else return false end | |
1203 | end | |
1204 | for i = 125, 0, -15 do | |
1205 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1206 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1207 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1208 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(5), 0) | |
1209 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1210 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(-5), 0) | |
1211 | wait() | |
1212 | else return false end | |
1213 | else return false end | |
1214 | end | |
1215 | for i = 1, 6 do | |
1216 | Player.Character[Name].Handle.Switch:Play() | |
1217 | makeShell(Player.Character[Name]:FindFirstChild("Cylinder")) | |
1218 | makeShell(Player.Character[Name.. " (Left)"]:FindFirstChild("Cylinder")) | |
1219 | wait(0.04) | |
1220 | end | |
1221 | magazine.Value = 0 | |
1222 | Player.Character[Name].Handle.Reload:Play() | |
1223 | for i = 0, 125, 15 do | |
1224 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1225 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1226 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1227 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(5), 0) | |
1228 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1229 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(-5), 0) | |
1230 | wait() | |
1231 | else return false end | |
1232 | else return false end | |
1233 | end | |
1234 | coroutine.wrap(function() | |
1235 | for i = 1, 0, -0.25 do | |
1236 | pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i * 90), 0) end) | |
1237 | pcall(function() Player.Character[Name.. " (Left)"].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i * 90), 0) end) | |
1238 | wait() | |
1239 | end | |
1240 | pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0) end) | |
1241 | pcall(function() Player.Character[Name.. " (Left)"].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0) end) | |
1242 | end)() | |
1243 | Player.Character[Name].Handle.Release:Play() | |
1244 | for i = 25, 0, -5 do | |
1245 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1246 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1247 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1248 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0) | |
1249 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1250 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1251 | wait() | |
1252 | else return false end | |
1253 | else return false end | |
1254 | end | |
1255 | end | |
1256 | if format == "hammer" then | |
1257 | Player.Character[Name].Handle.Reload:Play() | |
1258 | for i = 25, 0, -5 do | |
1259 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1260 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1261 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1262 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + (i / 30), 0.5, 0.6 + (i / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), math.rad((25 * 2) - ((25 - i) * 2))) | |
1263 | wait() | |
1264 | else return false end | |
1265 | else return false end | |
1266 | end | |
1267 | Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0) | |
1268 | end | |
1269 | if format == "fire" then | |
1270 | coroutine.resume(coroutine.create(function() | |
1271 | if Hammer == false then | |
1272 | Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0) | |
1273 | wait(0.04) | |
1274 | Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0) | |
1275 | else | |
1276 | Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0) | |
1277 | Hammer = false | |
1278 | end | |
1279 | end)) | |
1280 | if Player.Character[Name]:FindFirstChild("Handle") ~= nil then | |
1281 | if silenced then | |
1282 | Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10 | |
1283 | Player.Character[Name].Handle.Fire.Pitch = math.random(35, 40) / 15 | |
1284 | Player.Character[Name].Handle.Fire:Play() | |
1285 | CamShake(15, 50000) | |
1286 | else | |
1287 | Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10 | |
1288 | Player.Character[Name].Handle.Fire.Pitch = math.random(25, 35) / 20 | |
1289 | Player.Character[Name].Handle.Fire:Play() | |
1290 | CamShake(15, 50000) | |
1291 | end | |
1292 | else return false end | |
1293 | if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then | |
1294 | if silenced == false then | |
1295 | coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end)) | |
1296 | else end | |
1297 | else return false end | |
1298 | for i = 0, 10, 5 do | |
1299 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1300 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1301 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1302 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), math.rad(i), math.rad(-90)) | |
1303 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1304 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1305 | wait() | |
1306 | else return false end | |
1307 | else return false end | |
1308 | end | |
1309 | for i = 10, 0, -5 do | |
1310 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1311 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1312 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1313 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), math.rad(i), math.rad(-90)) | |
1314 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1315 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0) | |
1316 | wait() | |
1317 | else return false end | |
1318 | else return false end | |
1319 | end | |
1320 | end | |
1321 | if format == "rightFire" then | |
1322 | coroutine.resume(coroutine.create(function() | |
1323 | if Hammer == false then | |
1324 | Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0) | |
1325 | wait(0.04) | |
1326 | Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0) | |
1327 | else | |
1328 | Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0) | |
1329 | Hammer = false | |
1330 | end | |
1331 | end)) | |
1332 | if Player.Character[Name]:FindFirstChild("Handle") ~= nil then | |
1333 | if silenced then | |
1334 | Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10 | |
1335 | Player.Character[Name].Handle.Fire.Pitch = math.random(35, 40) / 15 | |
1336 | Player.Character[Name].Handle.Fire:Play() | |
1337 | CamShake(15, 50000) | |
1338 | else | |
1339 | Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10 | |
1340 | Player.Character[Name].Handle.Fire.Pitch = math.random(25, 35) / 20 | |
1341 | Player.Character[Name].Handle.Fire:Play() | |
1342 | CamShake(15, 50000) | |
1343 | end | |
1344 | else return false end | |
1345 | if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then | |
1346 | if silenced == false then | |
1347 | coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end)) | |
1348 | else end | |
1349 | else return false end | |
1350 | for i = 0, 10, 5 do | |
1351 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1352 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1353 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1354 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), 0, math.rad(-10)) | |
1355 | wait() | |
1356 | else return false end | |
1357 | else return false end | |
1358 | end | |
1359 | for i = 10, 0, -5 do | |
1360 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1361 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1362 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new() | |
1363 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), 0, math.rad(-10)) | |
1364 | wait() | |
1365 | else return false end | |
1366 | else return false end | |
1367 | end | |
1368 | end | |
1369 | if format == "leftFire" then | |
1370 | coroutine.resume(coroutine.create(function() | |
1371 | if Hammer == false then | |
1372 | Player.Character[Name.. "(Left)"].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0) | |
1373 | wait(0.04) | |
1374 | Player.Character[Name.. "(Left)"].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0) | |
1375 | else | |
1376 | Player.Character[Name.. "(Left)"].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0) | |
1377 | Hammer = false | |
1378 | end | |
1379 | end)) | |
1380 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") ~= nil then | |
1381 | if silenced then | |
1382 | Player.Character[Name.. " (Left)"].Handle.Fire.Volume = math.random(3, 8) / 10 | |
1383 | Player.Character[Name.. " (Left)"].Handle.Fire.Pitch = math.random(25, 40) / 15 | |
1384 | Player.Character[Name.. " (Left)"].Handle.Fire:Play() | |
1385 | CamShake(15, 50000) | |
1386 | else | |
1387 | Player.Character[Name.. " (Left)"].Handle.Fire.Volume = math.random(8, 12) / 10 | |
1388 | Player.Character[Name.. " (Left)"].Handle.Fire.Pitch = math.random(25, 35) / 20 | |
1389 | Player.Character[Name.. " (Left)"].Handle.Fire:Play() | |
1390 | CamShake(15, 50000) | |
1391 | end | |
1392 | end | |
1393 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") ~= nil then | |
1394 | if silenced == false then | |
1395 | coroutine.resume(coroutine.create(function() Player.Character[Name.. " (Left)"].Muzzle.Smoke.Enabled = true Player.Character[Name.. " (Left)"].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name.. " (Left)"].Muzzle.Smoke.Enabled = false Player.Character[Name.. " (Left)"].Muzzle.Fire.Enabled = false end)) | |
1396 | else end | |
1397 | end | |
1398 | for i = 0, 10, 5 do | |
1399 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1400 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1401 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1402 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), 0, math.rad(10)) | |
1403 | wait() | |
1404 | else return false end | |
1405 | else return false end | |
1406 | end | |
1407 | for i = 10, 0, -5 do | |
1408 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
1409 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
1410 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new() | |
1411 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), 0, math.rad(10)) | |
1412 | wait() | |
1413 | else return false end | |
1414 | else return false end | |
1415 | end | |
1416 | end | |
1417 | return true | |
1418 | end | |
1419 | ||
1420 | ||
1421 | function CamShake(time, freq) | |
1422 | coroutine.resume(coroutine.create(function() | |
1423 | local cam = game:GetService("Workspace").CurrentCamera | |
1424 | local time = 10 | |
1425 | local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0) | |
1426 | if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end | |
1427 | if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end | |
1428 | cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude) | |
1429 | for i = 1, time do | |
1430 | cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude) | |
1431 | wait() | |
1432 | end | |
1433 | end)) | |
1434 | end | |
1435 | ||
1436 | ||
1437 | function makeShell(part) | |
1438 | if part == nil then return false end | |
1439 | local casing = Instance.new("Part") | |
1440 | casing.Name = "Shell" | |
1441 | casing.formFactor = "Custom" | |
1442 | casing.Size = Vector3.new(0.2, 0.26, 0.2) | |
1443 | casing.CFrame = CFrame.new(part.Position) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360))) | |
1444 | casing.BrickColor = BrickColor.new("New Yeller") | |
1445 | local mesh = Instance.new("CylinderMesh") | |
1446 | mesh.Scale = Vector3.new(0.4, 1, 0.4) | |
1447 | mesh.Parent = casing | |
1448 | casing.Parent = game:GetService("Workspace") | |
1449 | casing:BreakJoints() | |
1450 | coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end)) | |
1451 | end | |
1452 | ||
1453 | ||
1454 | function Weld(x, y) | |
1455 | local weld = Instance.new("Weld") | |
1456 | weld.Part0 = x | |
1457 | weld.Part1 = y | |
1458 | CJ = CFrame.new(x.Position) | |
1459 | C0 = x.CFrame:inverse() * CJ | |
1460 | C1 = y.CFrame:inverse() * CJ | |
1461 | weld.C0 = C0 | |
1462 | weld.C1 = C1 | |
1463 | weld.Parent = x | |
1464 | end | |
1465 | ||
1466 | ||
1467 | function tagHumanoid(humanoid) | |
1468 | local tag = Instance.new("ObjectValue") | |
1469 | tag.Name = "creator" | |
1470 | tag.Value = Player | |
1471 | tag.Parent = humanoid | |
1472 | local tag = Instance.new("StringValue") | |
1473 | tag.Name = "creatorType1" | |
1474 | tag.Value = Name | |
1475 | tag.Parent = humanoid | |
1476 | local tag = Instance.new("StringValue") | |
1477 | tag.Name = "creatorType2" | |
1478 | tag.Value = "shot" | |
1479 | tag.Parent = humanoid | |
1480 | end | |
1481 | ||
1482 | ||
1483 | function untagHumanoid(humanoid) | |
1484 | if humanoid ~= nil then | |
1485 | local tag = humanoid:FindFirstChild("creator") | |
1486 | if tag ~= nil then | |
1487 | tag:Remove() | |
1488 | end | |
1489 | local tag = humanoid:FindFirstChild("creatorType1") | |
1490 | if tag ~= nil then | |
1491 | tag:Remove() | |
1492 | end | |
1493 | local tag = humanoid:FindFirstChild("creatorType2") | |
1494 | if tag ~= nil then | |
1495 | tag:Remove() | |
1496 | end | |
1497 | end | |
1498 | end | |
1499 | ||
1500 | ||
1501 | function fire(startPoint, endPoint, hit) | |
1502 | local trail = Instance.new("Part") | |
1503 | trail.Name = "Bullet Trail" | |
1504 | trail.BrickColor = BrickColor.new("New Yeller") | |
1505 | trail.TopSurface = 0 | |
1506 | trail.BottomSurface = 0 | |
1507 | trail.formFactor = 0 | |
1508 | trail.Size = Vector3.new(1, 1, 1) | |
1509 | trail.Transparency = 0.5 | |
1510 | trail.Anchored = true | |
1511 | trail.CanCollide = false | |
1512 | trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint) | |
1513 | trail.Parent = game:GetService("Workspace") | |
1514 | local mesh = Instance.new("SpecialMesh") | |
1515 | mesh.MeshType = "Brick" | |
1516 | mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude) | |
1517 | mesh.Parent = trail | |
1518 | coroutine.resume(coroutine.create(function(part) for i = 1, 10 do part.Mesh.Scale = Vector3.new(part.Mesh.Scale.x - 0.01, part.Mesh.Scale.y - 0.01, part.Mesh.Scale.z) wait() end part:Remove() end), trail) | |
1519 | if hit ~= nil then | |
1520 | if hit.Parent == nil then return end | |
1521 | if hit.Parent.ClassName == "Hat" then | |
1522 | if hit.Parent.Parent.Humanoid ~= nil then | |
1523 | hit.Parent.Parent.Humanoid:TakeDamage(damage * 5) | |
1524 | end | |
1525 | end | |
1526 | if hit.Parent:FindFirstChild("Humanoid") ~= nil then | |
1527 | tagHumanoid(hit.Parent.Humanoid) | |
1528 | if hit.Name == "Head" then | |
1529 | hit.Parent.Humanoid:TakeDamage(damage * 10) | |
1530 | elseif hit.Name == "Torso" then | |
1531 | hit.Parent.Humanoid:TakeDamage(damage * 2) | |
1532 | elseif hit.Name == "Left Leg" then | |
1533 | hit.Parent.Humanoid:TakeDamage(damage) | |
1534 | hit.Parent.Humanoid.Sit = false | |
1535 | elseif hit.Name == "Right Leg" then | |
1536 | hit.Parent.Humanoid:TakeDamage(damage) | |
1537 | hit.Parent.Humanoid.Sit = false | |
1538 | else | |
1539 | hit.Parent.Humanoid:TakeDamage(damage) | |
1540 | end | |
1541 | if math.random(1, 10) == 1 then | |
1542 | hit.Parent.Humanoid.Sit = false | |
1543 | end | |
1544 | delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end) | |
1545 | end | |
1546 | if hit.Anchored == false then | |
1547 | hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2)) | |
1548 | end | |
1549 | end | |
1550 | end | |
1551 | ||
1552 | ||
1553 | function onButton1Down(mouse) | |
1554 | if selected == false then return end | |
1555 | if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canFire == true and (function() if dual == true then if Player.Character:FindFirstChild(Name.. " (Left)") ~= nil then return true else return false end else return true end end)() == true then | |
1556 | if Player.Character[Name]:FindFirstChild("Handle") == nil then return end | |
1557 | if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end | |
1558 | if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end | |
1559 | if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end | |
1560 | mouse.Icon = "http://www.roblox.com/asset/?id=59125642" | |
1561 | Button1Down = true | |
1562 | canFire = false | |
1563 | canFire2 = true | |
1564 | while canFire2 == true do | |
1565 | local humanoid = Player.Character:FindFirstChild("Humanoid") | |
1566 | if humanoid == nil then | |
1567 | canFire2 = false | |
1568 | break | |
1569 | end | |
1570 | if humanoid.Health <= 0 then | |
1571 | canFire2 = false | |
1572 | break | |
1573 | end | |
1574 | local fireLeft = false | |
1575 | if automatic == false and burst == false then | |
1576 | canFire2 = false | |
1577 | elseif automatic == false and burst == true then | |
1578 | if burstCount >= burstCountMax then | |
1579 | canFire2 = false | |
1580 | burstCount = 0 | |
1581 | break | |
1582 | end | |
1583 | burstCount = burstCount + 1 | |
1584 | elseif automatic == true and burst == false then | |
1585 | fireLeft = true | |
1586 | end | |
1587 | if magazine.Value > 0 then | |
1588 | magazine.Value = magazine.Value - Chamber | |
1589 | updateGui() | |
1590 | if silenced == true then | |
1591 | CamShake(1, Spread) | |
1592 | else end | |
1593 | fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target) | |
1594 | coroutine.resume(coroutine.create(function() | |
1595 | if dual == true then | |
1596 | playAnimation("rightFire") | |
1597 | elseif dual == false then | |
1598 | playAnimation("fire") | |
1599 | end | |
1600 | end)) | |
1601 | if dual == true then | |
1602 | wait(math.random(0, 0.15)) | |
1603 | fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target) | |
1604 | coroutine.resume(coroutine.create(function() | |
1605 | playAnimation("leftFire") | |
1606 | end)) | |
1607 | end | |
1608 | else | |
1609 | Player.Character[Name].Handle.Empty:Play() | |
1610 | end | |
1611 | if fireLeft == true and dual == true and automatic == true then | |
1612 | if magazine.Value > 0 then | |
1613 | coroutine.resume(coroutine.create(function() | |
1614 | wait(readyTime / 2) | |
1615 | magazine.Value = magazine.Value - 1 | |
1616 | updateGui() | |
1617 | fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target) | |
1618 | if silenced == true then | |
1619 | CamShake(1, Spread) | |
1620 | else end | |
1621 | playAnimation("leftFire") | |
1622 | end)) | |
1623 | else | |
1624 | coroutine.resume(coroutine.create(function() | |
1625 | wait(readyTime / 2) | |
1626 | Player.Character[Name].Handle.Empty:Play() | |
1627 | end)) | |
1628 | end | |
1629 | end | |
1630 | wait(readyTime) | |
1631 | end | |
1632 | if magazine.Value ~= 0 then | |
1633 | mouse.Icon = "http://www.roblox.com/asset/?id=59125633" | |
1634 | else end | |
1635 | canFire = true | |
1636 | end | |
1637 | end | |
1638 | ||
1639 | ||
1640 | function onButton1Up(mouse) | |
1641 | if selected == false then return end | |
1642 | Button1Down = false | |
1643 | canFire2 = false | |
1644 | burstCount = 0 | |
1645 | while canFire == false do wait() end | |
1646 | if dual == true and automatic == false then | |
1647 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end | |
1648 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end | |
1649 | mouse.Icon = "http://www.roblox.com/asset/?id=59125642" | |
1650 | canFire = false | |
1651 | canFire2 = true | |
1652 | while canFire2 == true do | |
1653 | local humanoid = Player.Character:FindFirstChild("Humanoid") | |
1654 | if humanoid == nil then | |
1655 | canFire2 = false | |
1656 | break | |
1657 | end | |
1658 | if humanoid.Health <= 0 then | |
1659 | canFire2 = false | |
1660 | break | |
1661 | end | |
1662 | if burst == false then | |
1663 | canFire2 = false | |
1664 | elseif burst == true then | |
1665 | if burstCount >= burstCountMax then | |
1666 | canFire2 = false | |
1667 | burstCount = 0 | |
1668 | break | |
1669 | end | |
1670 | burstCount = burstCount + 1 | |
1671 | end | |
1672 | if magazine.Value <= 0 then | |
1673 | Player.Character[Name].Handle.Empty:Play() | |
1674 | else end | |
1675 | end | |
1676 | if magazine.Value ~= 0 then | |
1677 | mouse.Icon = "http://www.roblox.com/asset/?id=59125633" | |
1678 | else end | |
1679 | canFire = true | |
1680 | end | |
1681 | end | |
1682 | ||
1683 | ||
1684 | function onKeyDown(key, mouse) | |
1685 | if selected == false then return end | |
1686 | key = key:lower() | |
1687 | if key == "q" and Button1Down == false and canFire == true then | |
1688 | if mouse.Target == nil then return end | |
1689 | if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then | |
1690 | if dual == true then onKeyDown("t", mouse) end | |
1691 | onDeselected(mouse) | |
1692 | removeParts("RightHolster") | |
1693 | script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack | |
1694 | end | |
1695 | end | |
1696 | if key == "e" and Button1Down == false and canFire == true and canSilence == true then | |
1697 | if silenced then | |
1698 | silenced = false | |
1699 | Player.Character[Name].Handle.Lock.Pitch = 5 | |
1700 | Player.Character[Name].Handle.Lock:Play() | |
1701 | if Player.Character:FindFirstChild(Name) == nil then return end | |
1702 | if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end | |
1703 | if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end | |
1704 | Player.Character[Name].Muzzle.Transparency = 1 | |
1705 | Player.Character[Name].Muzzle.Name = "Silencer" | |
1706 | Player.Character[Name]["Muzzle 2"].Name = "Muzzle" | |
1707 | if dual == true then | |
1708 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end | |
1709 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end | |
1710 | Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1 | |
1711 | Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer" | |
1712 | Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle" | |
1713 | end | |
1714 | else | |
1715 | silenced = true | |
1716 | Player.Character[Name].Handle.Lock.Pitch = 5 | |
1717 | Player.Character[Name].Handle.Lock:Play() | |
1718 | if Player.Character:FindFirstChild(Name) == nil then return end | |
1719 | if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end | |
1720 | if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end | |
1721 | Player.Character[Name].Silencer.Transparency = 0 | |
1722 | Player.Character[Name].Muzzle.Name = "Muzzle 2" | |
1723 | Player.Character[Name].Silencer.Name = "Muzzle" | |
1724 | if dual == true then | |
1725 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end | |
1726 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end | |
1727 | Player.Character[Name.. " (Left)"].Silencer.Transparency = 0 | |
1728 | Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2" | |
1729 | Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle" | |
1730 | end | |
1731 | end | |
1732 | end | |
1733 | if key == "r" and Button1Down == false and canFire == true then | |
1734 | if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then | |
1735 | canFire = false | |
1736 | burstCount = 0 | |
1737 | mouse.Icon = "http://www.roblox.com/asset/?id=59125642" | |
1738 | updateGui() | |
1739 | if dual == true then | |
1740 | playAnimation("reloadDual") | |
1741 | elseif dual == false then | |
1742 | playAnimation("reload") | |
1743 | end | |
1744 | if dual == true then | |
1745 | if ammo.Value - magazineMax.Value < 0 then | |
1746 | magazine.Value = ammo.Value | |
1747 | ammo.Value = 0 | |
1748 | elseif ammo.Value - magazineMax.Value >= 0 then | |
1749 | ammo.Value = ammo.Value - magazineMax.Value | |
1750 | magazine.Value = magazine.Value + magazineMax.Value | |
1751 | end | |
1752 | else end | |
1753 | updateGui() | |
1754 | mouse.Icon = "http://www.roblox.com/asset/?id=59125633" | |
1755 | canFire = true | |
1756 | end | |
1757 | end | |
1758 | if key == "t" and Button1Down == false and canFire == true and canDual == true then | |
1759 | canFire = false | |
1760 | if dual == false then | |
1761 | local weapon = nil | |
1762 | for _, p in pairs(Player.Backpack:GetChildren()) do | |
1763 | if p.Name == Name and p ~= script.Parent then weapon = p break end | |
1764 | end | |
1765 | if weapon ~= nil then | |
1766 | dual = true | |
1767 | Chamber = 2 | |
1768 | weapon.Name = "Dual" | |
1769 | weapon.Parent = script | |
1770 | removeParts("RightHand") | |
1771 | makeParts("RightHand") | |
1772 | removeParts("RightHolster") | |
1773 | makeParts("LeftHolster") | |
1774 | playAnimation("leftEquip") | |
1775 | removeParts("LeftHolster") | |
1776 | makeParts("LeftHand") | |
1777 | magazineMax.Value = math.ceil(magazineMax.Value * 2) | |
1778 | ammoMax.Value = math.ceil(ammoMax.Value * 2) | |
1779 | magazine.Value = magazine.Value + weapon.Magazine.Value | |
1780 | ammo.Value = ammo.Value + weapon.Ammo.Value | |
1781 | updateGui() | |
1782 | end | |
1783 | elseif dual == true then | |
1784 | local weapon = script:FindFirstChild("Dual") | |
1785 | if weapon ~= nil then | |
1786 | dual = false | |
1787 | Chamber = 1 | |
1788 | weapon.Name = Name | |
1789 | weapon.Parent = Player.Backpack | |
1790 | removeParts("RightHand") | |
1791 | makeParts("RightHand") | |
1792 | playAnimation("leftUnequip") | |
1793 | removeParts("LeftHand") | |
1794 | makeParts("RightHolster") | |
1795 | playAnimation("hold") | |
1796 | weapon.Magazine.Value = math.floor(magazine.Value / 2) | |
1797 | weapon.Ammo.Value = math.floor(ammo.Value / 2) | |
1798 | magazineMax.Value = math.ceil(magazineMax.Value / 2) | |
1799 | ammoMax.Value = math.ceil(ammoMax.Value / 2) | |
1800 | magazine.Value = math.ceil(magazine.Value / 2) | |
1801 | ammo.Value = math.ceil(ammo.Value / 2) | |
1802 | updateGui() | |
1803 | end | |
1804 | end | |
1805 | canFire = true | |
1806 | end | |
1807 | if key == "y" and canZoom == true then | |
1808 | if zoom == false then | |
1809 | zoom = true | |
1810 | local pos = mouse.Hit.p | |
1811 | local target = mouse.Target | |
1812 | local cam = game:GetService("Workspace").CurrentCamera | |
1813 | focus = Instance.new("Part", workspace) | |
1814 | focus.Anchored = true | |
1815 | focus.CanCollide = false | |
1816 | focus.Transparency = 1 | |
1817 | focus.TopSurface = 0 | |
1818 | focus.BottomSurface = 0 | |
1819 | focus.formFactor = "Plate" | |
1820 | focus.Size = Vector3.new(0, 0, 0) | |
1821 | focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p) | |
1822 | cam.CameraSubject = focus | |
1823 | cam.CameraType = "Attach" | |
1824 | while zoom == true and selected == true do | |
1825 | local set = false | |
1826 | if target ~= nil then | |
1827 | if target.Parent ~= nil then | |
1828 | if target.Anchored == false then | |
1829 | focus.CFrame = CFrame.new(target.CFrame.p) * (CFrame.new(Player.Character.Torso.CFrame.p, target.CFrame.p) - CFrame.new(Player.Character.Torso.CFrame.p, target.CFrame.p).p) | |
1830 | set = true | |
1831 | end | |
1832 | end | |
1833 | end | |
1834 | if set == false then | |
1835 | focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p) | |
1836 | end | |
1837 | wait() | |
1838 | end | |
1839 | if focus ~= nil then focus:Remove() focus = nil end | |
1840 | local cam = game:GetService("Workspace").CurrentCamera | |
1841 | cam.CameraSubject = Player.Character:FindFirstChild("Humanoid") | |
1842 | cam.CameraType = "Custom" | |
1843 | else | |
1844 | zoom = false | |
1845 | end | |
1846 | end | |
1847 | if key == "u" and Button1Down == false and canFire == true then | |
1848 | if automatic == false and burst == false then | |
1849 | if switchToBurst == true then | |
1850 | burst = true | |
1851 | local m = Instance.new("Message", Player) | |
1852 | m.Text = "Burst" | |
1853 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1854 | delay(2.5, function() m:Remove() end) | |
1855 | elseif switchToAutomatic == true then | |
1856 | automatic = true | |
1857 | local m = Instance.new("Message", Player) | |
1858 | m.Text = "Automatic" | |
1859 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1860 | delay(2.5, function() m:Remove() end) | |
1861 | end | |
1862 | elseif automatic == false and burst == true then | |
1863 | if switchToAutomatic == true then | |
1864 | automatic = true | |
1865 | burst = false | |
1866 | local m = Instance.new("Message", Player) | |
1867 | m.Text = "Automatic" | |
1868 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1869 | delay(2.5, function() m:Remove() end) | |
1870 | elseif switchToSingle == true then | |
1871 | burst = false | |
1872 | local m = Instance.new("Message", Player) | |
1873 | m.Text = "Single" | |
1874 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1875 | delay(2.5, function() m:Remove() end) | |
1876 | end | |
1877 | elseif automatic == true and burst == false then | |
1878 | if switchToSingle == true then | |
1879 | automatic = false | |
1880 | local m = Instance.new("Message", Player) | |
1881 | m.Text = "Single" | |
1882 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1883 | delay(2.5, function() m:Remove() end) | |
1884 | elseif switchToBurst == true then | |
1885 | automatic = false | |
1886 | burst = true | |
1887 | local m = Instance.new("Message", Player) | |
1888 | m.Text = "Burst" | |
1889 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1890 | delay(2.5, function() m:Remove() end) | |
1891 | end | |
1892 | end | |
1893 | end | |
1894 | if key == "c" and Hammer == false and dual == false and canFire == true then | |
1895 | playAnimation("hammer") | |
1896 | Hammer = true | |
1897 | end | |
1898 | end | |
1899 | ||
1900 | ||
1901 | function onSelected(mouse) | |
1902 | if selected == true then return end | |
1903 | selected = true | |
1904 | canFire = false | |
1905 | mouse.Icon = "http://www.roblox.com/asset/?id=59125642" | |
1906 | while Player.Character:FindFirstChild("WeaponActivated") ~= nil do | |
1907 | if Player.Character.WeaponActivated.Value == nil then break end | |
1908 | if Player.Character.WeaponActivated.Value.Parent == nil then break end | |
1909 | wait() | |
1910 | end | |
1911 | updateGui() | |
1912 | local weapon = Instance.new("ObjectValue") | |
1913 | weapon.Name = "WeaponActivated" | |
1914 | weapon.Value = script.Parent | |
1915 | weapon.Parent = Player.Character | |
1916 | DisableLimb(1, Player.Character) | |
1917 | DisableLimb(2, Player.Character) | |
1918 | ForceAngle(1, 0, Player.Character) | |
1919 | ForceAngle(2, 0, Player.Character) | |
1920 | if dual == true then | |
1921 | coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end)) | |
1922 | playAnimation("rightEquip") | |
1923 | removeParts("LeftHolster") | |
1924 | makeParts("LeftHand") | |
1925 | else | |
1926 | playAnimation("equip") | |
1927 | end | |
1928 | removeParts("RightHolster") | |
1929 | makeParts("RightHand") | |
1930 | mouse.Button1Down:connect(function() onButton1Down(mouse) end) | |
1931 | mouse.Button1Up:connect(function() onButton1Up(mouse) end) | |
1932 | mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end) | |
1933 | mouse.Icon = "http://www.roblox.com/asset/?id=59125633" | |
1934 | canFire = true | |
1935 | end | |
1936 | ||
1937 | ||
1938 | function onDeselected(mouse) | |
1939 | if selected == false then return end | |
1940 | Button1Down = false | |
1941 | while canFire == false do | |
1942 | wait() | |
1943 | end | |
1944 | selected = false | |
1945 | if dual == true then | |
1946 | if math.random(1, 2) == 1 then | |
1947 | coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end)) | |
1948 | wait(math.random(1, 10) / 10) | |
1949 | playAnimation("rightUnequip") | |
1950 | else | |
1951 | coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end)) | |
1952 | wait(math.random(1, 10) / 10) | |
1953 | playAnimation("leftUnequip") | |
1954 | end | |
1955 | removeParts("LeftHand") | |
1956 | makeParts("LeftHolster") | |
1957 | else | |
1958 | playAnimation("unequip") | |
1959 | end | |
1960 | removeParts("RightHand") | |
1961 | makeParts("RightHolster") | |
1962 | ForceAngle(1, 0, Player.Character) | |
1963 | ForceAngle(2, 0, Player.Character) | |
1964 | ResetLimbCFrame(1, Player.Character) | |
1965 | ResetLimbCFrame(2, Player.Character) | |
1966 | EnableLimb(1, Player.Character) | |
1967 | EnableLimb(2, Player.Character) | |
1968 | if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end | |
1969 | if Player.Character:FindFirstChild("WeaponActivated") ~= nil then | |
1970 | if Player.Character.WeaponActivated.Value == script.Parent then | |
1971 | Player.Character.WeaponActivated:Remove() | |
1972 | end | |
1973 | end | |
1974 | while Player.Character:FindFirstChild("WeaponActivated") ~= nil do | |
1975 | if Player.Character.WeaponActivated.Value == nil then break end | |
1976 | if Player.Character.WeaponActivated.Value.Parent == nil then break end | |
1977 | wait() | |
1978 | end | |
1979 | end | |
1980 | ||
1981 | ||
1982 | if script.Parent.className ~= "HopperBin" then | |
1983 | if Player == nil then print("Error: Player not found!") return end | |
1984 | Tool = Instance.new("HopperBin") | |
1985 | Tool.Name = Name | |
1986 | Tool.Parent = Player.Backpack | |
1987 | script.Name = "Main" | |
1988 | script.Parent = Tool | |
1989 | elseif script.Parent.className == "HopperBin" then | |
1990 | while script.Parent.Parent.className ~= "Backpack" do | |
1991 | wait() | |
1992 | end | |
1993 | if script.Parent:FindFirstChild("MagazineMax") == nil then | |
1994 | magazineMax = Instance.new("NumberValue") | |
1995 | magazineMax.Name = "MagazineMax" | |
1996 | magazineMax.Value = 1333333333333333337 | |
1997 | magazineMax.Parent = script.Parent | |
1998 | else | |
1999 | magazineMax = script.Parent.MagazineMax | |
2000 | end | |
2001 | if script.Parent:FindFirstChild("Magazine") == nil then | |
2002 | magazine = Instance.new("NumberValue") | |
2003 | magazine.Name = "Magazine" | |
2004 | magazine.Value = 133333333333333333337 | |
2005 | magazine.Parent = script.Parent | |
2006 | else | |
2007 | magazine = script.Parent.Magazine | |
2008 | end | |
2009 | if script.Parent:FindFirstChild("AmmoMax") == nil then | |
2010 | ammoMax = Instance.new("NumberValue") | |
2011 | ammoMax.Name = "AmmoMax" | |
2012 | ammoMax.Value = 133333333333333333333333333333333333333333333333333333333337 | |
2013 | ammoMax.Parent = script.Parent | |
2014 | else | |
2015 | ammoMax = script.Parent.AmmoMax | |
2016 | end | |
2017 | if script.Parent:FindFirstChild("Ammo") == nil then | |
2018 | ammo = Instance.new("NumberValue") | |
2019 | ammo.Name = "Ammo" | |
2020 | ammo.Value = script.Parent.AmmoMax.Value | |
2021 | ammo.Parent = script.Parent | |
2022 | else | |
2023 | ammo = script.Parent.Ammo | |
2024 | end | |
2025 | Player = script.Parent.Parent.Parent | |
2026 | makeParts("RightHolster") | |
2027 | script.Parent.Selected:connect(onSelected) | |
2028 | script.Parent.Deselected:connect(onDeselected) | |
2029 | end |