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