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