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