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