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