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