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