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