SHOW:
|
|
- or go back to the newest paste.
1 | - | --MADE BY OneLegend (NOT THE SCRIPT) Thanks to CyberFromLU for letting me Publish! REGULAR SCRIPT: Go to line 3 and 1607 put your name where it says "YOUR NAME HERE" |
1 | + | Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("thesuperfireguy9000") |
2 | - | ------------------------------------------------------------------- |
2 | + | Name = "thesuperfireguy9000" --Sets name of the RPG. |
3 | - | Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("DarkHearth3") --Replace my name with yours for the RPG to work. |
3 | + | |
4 | - | Name = "mogoon" --Sets name of the RPG. |
4 | + | |
5 | dual = false | |
6 | Button1Down = true | |
7 | damage = 100000 --Sets damage also. | |
8 | - | Button1Down = false |
8 | + | |
9 | - | damage = 100 --Sets damage also. |
9 | + | |
10 | readyTime = 0.5 | |
11 | automatic = false | |
12 | burst = false | |
13 | burstCount = 0 | |
14 | burstCountMax = 3 | |
15 | canSilence = false | |
16 | silenced = false | |
17 | canZoom = true | |
18 | zoom = false | |
19 | switchToSingle = true | |
20 | switchToBurst = true | |
21 | switchToAutomatic = false | |
22 | ||
23 | ||
24 | ammoGui = Instance.new("ScreenGui") | |
25 | ammoGui.Name = Name | |
26 | local frame = Instance.new("Frame") | |
27 | frame.Name = "Frame" | |
28 | frame.Size = UDim2.new(0, 165, 0, 60) | |
29 | frame.Position = UDim2.new(0, 0, 1, -60) | |
30 | frame.BackgroundColor3 = Color3.new(1, 1, 1) | |
31 | frame.BorderColor3 = Color3.new(0, 0, 0) | |
32 | frame.Parent = ammoGui | |
33 | local label = Instance.new("TextLabel") | |
34 | label.Name = "Weapon" | |
35 | label.Text = "Weapon: " ..Name | |
36 | label.Size = UDim2.new(1, 0, 0, 20) | |
37 | label.Position = UDim2.new(0, 0, 0, 0) | |
38 | label.BackgroundColor3 = Color3.new(1, 0, 0) | |
39 | label.BorderColor3 = Color3.new(0, 0, 0) | |
40 | label.Parent = frame | |
41 | local label = Instance.new("TextLabel") | |
42 | label.Name = "MagazinePrefix" | |
43 | label.Text = " Magazine:" | |
44 | label.TextXAlignment = "Left" | |
45 | label.Size = UDim2.new(1, 0, 0, 20) | |
46 | label.Position = UDim2.new(0, 0, 0, 20) | |
47 | label.BackgroundColor3 = Color3.new(1, 1, 1) | |
48 | label.BorderColor3 = Color3.new(0, 0, 0) | |
49 | label.Parent = frame | |
50 | local label = Instance.new("TextLabel") | |
51 | label.Name = "Magazine" | |
52 | label.Text = "0/0" | |
53 | label.TextXAlignment = "Right" | |
54 | label.Size = UDim2.new(1, 0, 0, 20) | |
55 | label.Position = UDim2.new(0, -10, 0, 20) | |
56 | label.BackgroundTransparency = 1 | |
57 | label.BorderSizePixel = 0 | |
58 | label.Parent = frame | |
59 | local label = Instance.new("TextLabel") | |
60 | label.Name = "AmmoPrefix" | |
61 | label.Text = " Ammunition:" | |
62 | label.TextXAlignment = "Left" | |
63 | label.Size = UDim2.new(1, 0, 0, 20) | |
64 | label.Position = UDim2.new(0, 0, 0, 40) | |
65 | label.BackgroundColor3 = Color3.new(1, 1, 1) | |
66 | label.BorderColor3 = Color3.new(0, 0, 0) | |
67 | label.Parent = frame | |
68 | local label = Instance.new("TextLabel") | |
69 | label.Name = "Ammo" | |
70 | label.Text = "0/0" | |
71 | label.TextXAlignment = "Right" | |
72 | label.Size = UDim2.new(1, 0, 0, 20) | |
73 | label.Position = UDim2.new(0, -10, 0, 40) | |
74 | label.BackgroundTransparency = 1 | |
75 | label.BorderSizePixel = 0 | |
76 | label.Parent = frame | |
77 | ||
78 | ||
79 | function updateGui() | |
80 | if selected == false then return end | |
81 | if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end | |
82 | if Player.PlayerGui:FindFirstChild(Name) == nil then | |
83 | ammoGui:Clone().Parent = Player.PlayerGui | |
84 | end | |
85 | Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value) | |
86 | Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value) | |
87 | end | |
88 | ||
89 | ||
90 | function makeParts(format) | |
91 | local model = Instance.new("Model") | |
92 | model.Name = Name | |
93 | local pm = Instance.new("Part") | |
94 | pm.Name = "Handle" | |
95 | pm.FormFactor = "Custom" | |
96 | pm.Size = Vector3.new(1, 1, 1) | |
97 | pm.BrickColor = BrickColor.new("Black") | |
98 | pm.Locked = true | |
99 | pm.TopSurface = 0 | |
100 | pm.BottomSurface = 0 | |
101 | pm.Parent = model | |
102 | local m = Instance.new("CylinderMesh") | |
103 | m.Scale = Vector3.new(0.35, 1.5, 0.35) | |
104 | m.Parent = pm | |
105 | if format ~= nil then | |
106 | local w = Instance.new("Weld") | |
107 | w.Part0 = pm | |
108 | if format == "RightHand" then | |
109 | w.Part1 = Player.Character:FindFirstChild("Right Arm") | |
110 | w.C0 = CFrame.new(0, 1.5, 0.75) | |
111 | w.C1 = CFrame.new() | |
112 | elseif format == "RightHolster" then | |
113 | w.Part1 = Player.Character:FindFirstChild("Torso") | |
114 | w.C0 = CFrame.new(-0.65, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(185), math.rad(90), 0) | |
115 | w.C1 = CFrame.new() | |
116 | model.Name = Name.. " (Holstered)" | |
117 | end | |
118 | w.Parent = pm | |
119 | model.Parent = Player.Character | |
120 | end | |
121 | --[[ | |
122 | sniper1 http://www.roblox.com/Asset/?id=1868836 | |
123 | equip http://www.roblox.com/Asset/?id=13510737 | |
124 | fire1 http://www.roblox.com/Asset/?id=2760979 | |
125 | fire2 http://www.roblox.com/Asset/?id=13510352 | |
126 | fire3 http://www.roblox.com/Asset/?id=2692806 | |
127 | fire4 http://www.roblox.com/Asset/?id=2691586 | |
128 | fire5 http://www.roblox.com/Asset/?id=2920959 | |
129 | fire6 http://www.roblox.com/Asset/?id=2697431 | |
130 | fire7 http://www.roblox.com/Asset/?id=2920959 | |
131 | reload1 http://www.roblox.com/Asset/?id=2691591 | |
132 | reload2 http://www.roblox.com/Asset/?id=2697432 | |
133 | reload3 http://www.roblox.com/Asset/?id=2920960 | |
134 | reload4 http://www.roblox.com/Asset/?id=2761842 | |
135 | shotgun1 http://www.roblox.com/Asset/?id=2697294 | |
136 | --]] | |
137 | local s = Instance.new("Sound") | |
138 | s.Name = "Equip" | |
139 | s.SoundId = "http://www.roblox.com/Asset/?id=10209881" | |
140 | s.Volume = 1 | |
141 | s.Pitch = 1 | |
142 | s.Looped = false | |
143 | s.Parent = pm | |
144 | local s = Instance.new("Sound") | |
145 | s.Name = "Fire" | |
146 | s.SoundId = "rbxasset://sounds/Shoulder fired rocket.wav" | |
147 | s.Volume = 1 | |
148 | s.Pitch = 1.25 | |
149 | s.Looped = false | |
150 | s.Parent = pm | |
151 | local s = Instance.new("Sound") | |
152 | s.Name = "Reload" | |
153 | s.SoundId = "http://www.roblox.com/Asset/?id=2691591" | |
154 | s.Volume = 1 | |
155 | s.Pitch = 1.25 | |
156 | s.Looped = false | |
157 | s.Parent = pm | |
158 | local s = Instance.new("Sound") | |
159 | s.Name = "Empty" | |
160 | s.SoundId = "http://www.roblox.com/Asset/?id=2697295" | |
161 | s.Volume = 1 | |
162 | s.Pitch = 5 | |
163 | s.Looped = false | |
164 | s.Parent = pm | |
165 | local s = Instance.new("Sound") | |
166 | s.Name = "Switch" | |
167 | s.SoundId = "http://www.roblox.com/Asset/?id=2697295" | |
168 | s.Volume = 1 | |
169 | s.Pitch = 10 | |
170 | s.Looped = false | |
171 | s.Parent = pm | |
172 | local p = Instance.new("Part") | |
173 | p.Name = "Grip / Trigger Housing" | |
174 | p.FormFactor = "Custom" | |
175 | p.Size = Vector3.new(1, 1, 1) | |
176 | p.BrickColor = BrickColor.new("Black") | |
177 | p.Locked = true | |
178 | p.TopSurface = 0 | |
179 | p.BottomSurface = 0 | |
180 | p.Parent = model | |
181 | local m = Instance.new("SpecialMesh") | |
182 | m.MeshType = "Brick" | |
183 | m.Scale = Vector3.new(0.29, 0.75, 0.1) | |
184 | m.Parent = p | |
185 | local w = Instance.new("Weld") | |
186 | w.Part0 = p | |
187 | w.Part1 = pm | |
188 | w.C0 = CFrame.new(0, -0.2, -0.15) | |
189 | w.C1 = CFrame.new() | |
190 | w.Parent = p | |
191 | local p = Instance.new("Part") | |
192 | p.Name = "Grip 1" | |
193 | p.FormFactor = "Custom" | |
194 | p.Size = Vector3.new(1, 1, 1) | |
195 | p.BrickColor = BrickColor.new("Black") | |
196 | p.Locked = true | |
197 | p.TopSurface = 0 | |
198 | p.BottomSurface = 0 | |
199 | p.Parent = model | |
200 | local m = Instance.new("SpecialMesh") | |
201 | m.MeshType = "Brick" | |
202 | m.Scale = Vector3.new(0.29, 0.35, 0.9) | |
203 | m.Parent = p | |
204 | local w = Instance.new("Weld") | |
205 | w.Part0 = p | |
206 | w.Part1 = pm | |
207 | w.C0 = CFrame.new(0, -0.4, -0.65) | |
208 | w.C1 = CFrame.new() | |
209 | w.Parent = p | |
210 | local p = Instance.new("Part") | |
211 | p.Name = "Grip 2" | |
212 | p.FormFactor = "Custom" | |
213 | p.Size = Vector3.new(1, 1, 1) | |
214 | p.BrickColor = BrickColor.new("Reddish brown") | |
215 | p.Material = "Wood" | |
216 | p.Locked = true | |
217 | p.TopSurface = 0 | |
218 | p.BottomSurface = 0 | |
219 | p.Parent = model | |
220 | local m = Instance.new("SpecialMesh") | |
221 | m.MeshType = "Brick" | |
222 | m.Scale = Vector3.new(0.29, 0.35, 0.8) | |
223 | m.Parent = p | |
224 | local w = Instance.new("Weld") | |
225 | w.Part0 = p | |
226 | w.Part1 = pm | |
227 | w.C0 = CFrame.new(0, -1.1, -0.575) | |
228 | w.C1 = CFrame.new() | |
229 | w.Parent = p | |
230 | local p = Instance.new("Part") | |
231 | p.Name = "Trigger Housing 1" | |
232 | p.FormFactor = "Custom" | |
233 | p.Size = Vector3.new(1, 1, 1) | |
234 | p.BrickColor = BrickColor.new("Black") | |
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.1, 0.25, 0.025) | |
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.1, -0.5) | |
247 | w.C1 = CFrame.new() | |
248 | w.Parent = p | |
249 | local p = Instance.new("Part") | |
250 | p.Name = "Trigger Housing 2" | |
251 | p.FormFactor = "Custom" | |
252 | p.Size = Vector3.new(1, 1, 1) | |
253 | p.BrickColor = BrickColor.new("Black") | |
254 | p.Locked = true | |
255 | p.TopSurface = 0 | |
256 | p.BottomSurface = 0 | |
257 | p.Parent = model | |
258 | local m = Instance.new("SpecialMesh") | |
259 | m.MeshType = "Brick" | |
260 | m.Scale = Vector3.new(0.1, 0.025, 0.3) | |
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.01, -0.35) | |
266 | w.C1 = CFrame.new() | |
267 | w.Parent = p | |
268 | local p = Instance.new("Part") | |
269 | p.Name = "Trigger" | |
270 | p.FormFactor = "Custom" | |
271 | p.Size = Vector3.new(1, 1, 1) | |
272 | p.BrickColor = BrickColor.new("Black") | |
273 | p.Locked = true | |
274 | p.TopSurface = 0 | |
275 | p.BottomSurface = 0 | |
276 | p.Parent = model | |
277 | local m = Instance.new("SpecialMesh") | |
278 | m.MeshType = "Brick" | |
279 | m.Scale = Vector3.new(0.1, 0.05, 0.15) | |
280 | m.Parent = p | |
281 | local w = Instance.new("Weld") | |
282 | w.Part0 = p | |
283 | w.Part1 = pm | |
284 | w.C0 = CFrame.new(0, -0.11, -0.275) | |
285 | w.C1 = CFrame.new() | |
286 | w.Parent = p | |
287 | local p = Instance.new("Part") | |
288 | p.Name = "Center 1" | |
289 | p.FormFactor = "Custom" | |
290 | p.Size = Vector3.new(1, 1, 1) | |
291 | p.BrickColor = BrickColor.new("Black") | |
292 | p.Locked = true | |
293 | p.TopSurface = 0 | |
294 | p.BottomSurface = 0 | |
295 | p.Parent = model | |
296 | local m = Instance.new("CylinderMesh") | |
297 | m.Scale = Vector3.new(0.4, 0.5, 0.4) | |
298 | m.Parent = p | |
299 | local w = Instance.new("Weld") | |
300 | w.Part0 = p | |
301 | w.Part1 = pm | |
302 | w.C0 = CFrame.new(0, -1, 0) | |
303 | w.C1 = CFrame.new() | |
304 | w.Parent = p | |
305 | local p = Instance.new("Part") | |
306 | p.Name = "Center 2" | |
307 | p.FormFactor = "Custom" | |
308 | p.Size = Vector3.new(1, 1, 1) | |
309 | p.BrickColor = BrickColor.new("Reddish brown") | |
310 | p.Material = "Wood" | |
311 | p.Locked = true | |
312 | p.TopSurface = 0 | |
313 | p.BottomSurface = 0 | |
314 | p.Parent = model | |
315 | local m = Instance.new("CylinderMesh") | |
316 | m.Scale = Vector3.new(0.45, 1, 0.45) | |
317 | m.Parent = p | |
318 | local w = Instance.new("Weld") | |
319 | w.Part0 = p | |
320 | w.Part1 = pm | |
321 | w.C0 = CFrame.new(0, -1.75, 0) | |
322 | w.C1 = CFrame.new() | |
323 | w.Parent = p | |
324 | local p = Instance.new("Part") | |
325 | p.Name = "Center 3" | |
326 | p.FormFactor = "Custom" | |
327 | p.Size = Vector3.new(1, 1, 1) | |
328 | p.BrickColor = BrickColor.new("Reddish brown") | |
329 | p.Material = "Wood" | |
330 | p.Locked = true | |
331 | p.TopSurface = 0 | |
332 | p.BottomSurface = 0 | |
333 | p.Parent = model | |
334 | local m = Instance.new("SpecialMesh") | |
335 | m.MeshType = "FileMesh" | |
336 | m.MeshId = "http://www.roblox.com/Asset/?id=1778999" | |
337 | m.Scale = Vector3.new(0.335, 0.45, 0.335) | |
338 | m.Parent = p | |
339 | local w = Instance.new("Weld") | |
340 | w.Part0 = p | |
341 | w.Part1 = pm | |
342 | w.C0 = CFrame.new(0, -2.6225, 0) | |
343 | w.C1 = CFrame.new() | |
344 | w.Parent = p | |
345 | local p = Instance.new("Part") | |
346 | p.Name = "Center 4" | |
347 | p.FormFactor = "Custom" | |
348 | p.Size = Vector3.new(1, 1, 1) | |
349 | p.BrickColor = BrickColor.new("Reddish brown") | |
350 | p.Material = "Wood" | |
351 | p.Locked = true | |
352 | p.TopSurface = 0 | |
353 | p.BottomSurface = 0 | |
354 | p.Parent = model | |
355 | local m = Instance.new("CylinderMesh") | |
356 | m.Scale = Vector3.new(0.325, 1.25, 0.325) | |
357 | m.Parent = p | |
358 | local w = Instance.new("Weld") | |
359 | w.Part0 = p | |
360 | w.Part1 = pm | |
361 | w.C0 = CFrame.new(0, -3, 0) | |
362 | w.C1 = CFrame.new() | |
363 | w.Parent = p | |
364 | local p = Instance.new("Part") | |
365 | p.Name = "End 1" | |
366 | p.FormFactor = "Custom" | |
367 | p.Size = Vector3.new(1, 1, 1) | |
368 | p.BrickColor = BrickColor.new("Black") | |
369 | p.CanCollide = false | |
370 | p.Locked = true | |
371 | p.TopSurface = 0 | |
372 | p.BottomSurface = 0 | |
373 | p.Parent = model | |
374 | local m = Instance.new("CylinderMesh") | |
375 | m.Scale = Vector3.new(0.31, 0.1, 0.31) | |
376 | m.Parent = p | |
377 | local w = Instance.new("Weld") | |
378 | w.Part0 = p | |
379 | w.Part1 = pm | |
380 | w.C0 = CFrame.new(0, -3.625, 0) | |
381 | w.C1 = CFrame.new() | |
382 | w.Parent = p | |
383 | local p = Instance.new("Part") | |
384 | p.Name = "End 2" | |
385 | p.FormFactor = "Custom" | |
386 | p.Size = Vector3.new(1, 1, 1) | |
387 | p.BrickColor = BrickColor.new("Black") | |
388 | p.CanCollide = false | |
389 | p.Locked = true | |
390 | p.TopSurface = 0 | |
391 | p.BottomSurface = 0 | |
392 | p.Parent = model | |
393 | local m = Instance.new("SpecialMesh") | |
394 | m.MeshType = "FileMesh" | |
395 | m.MeshId = "http://www.roblox.com/Asset/?id=1778999" | |
396 | m.Scale = Vector3.new(0.425, 0.875, 0.425) | |
397 | m.Parent = p | |
398 | local w = Instance.new("Weld") | |
399 | w.Part0 = p | |
400 | w.Part1 = pm | |
401 | w.C0 = CFrame.new(0, 3.61, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0) | |
402 | w.C1 = CFrame.new() | |
403 | w.Parent = p | |
404 | local f = Instance.new("Fire") | |
405 | f.Enabled = false | |
406 | f.Name = "Fire" | |
407 | f.Color = Color3.new(1, 0.5, 0) | |
408 | f.SecondaryColor = Color3.new(1, 0.75, 0.5) | |
409 | f.Heat = -25 | |
410 | f.Size = 5 | |
411 | f.Parent = p | |
412 | local s = Instance.new("Smoke") | |
413 | s.Enabled = false | |
414 | s.Name = "Smoke" | |
415 | s.Opacity = 0.5 | |
416 | s.Color = Color3.new(0.8, 0.8, 0.8) | |
417 | s.RiseVelocity = -10 | |
418 | s.Size = 5 | |
419 | s.Parent = p | |
420 | local p = Instance.new("Part") | |
421 | p.Name = "Muzzle" | |
422 | p.FormFactor = "Custom" | |
423 | p.Size = Vector3.new(1, 1, 1) | |
424 | p.Transparency = 1 | |
425 | p.CanCollide = false | |
426 | p.Locked = true | |
427 | p.Parent = model | |
428 | local w = Instance.new("Weld") | |
429 | w.Part0 = p | |
430 | w.Part1 = pm | |
431 | w.C0 = CFrame.new(0, 0.26, 0) | |
432 | w.C1 = CFrame.new() | |
433 | w.Parent = p | |
434 | local f = Instance.new("Fire") | |
435 | f.Enabled = false | |
436 | f.Name = "Fire" | |
437 | f.Color = Color3.new(1, 0.5, 0) | |
438 | f.SecondaryColor = Color3.new(1, 0.75, 0.5) | |
439 | f.Heat = -25 | |
440 | f.Size = 2.5 | |
441 | f.Parent = p | |
442 | local s = Instance.new("Smoke") | |
443 | s.Enabled = false | |
444 | s.Name = "Smoke" | |
445 | s.Opacity = 0.3 | |
446 | s.Color = Color3.new(0.8, 0.8, 0.8) | |
447 | s.RiseVelocity = -10 | |
448 | s.Size = 2.5 | |
449 | s.Parent = p | |
450 | local pm2 = Instance.new("Part") | |
451 | if magazine.Value <= 0 then pm2.Transparency = 1 end | |
452 | pm2.Name = "Projectile" | |
453 | pm2.FormFactor = "Custom" | |
454 | pm2.Size = Vector3.new(1, 1, 1) | |
455 | pm2.BrickColor = BrickColor.new("Bright red") | |
456 | pm2.CanCollide = false | |
457 | pm2.Locked = true | |
458 | pm2.TopSurface = 0 | |
459 | pm2.BottomSurface = 0 | |
460 | pm2.Parent = model | |
461 | local m = Instance.new("CylinderMesh") | |
462 | m.Scale = Vector3.new(0.2, 1, 0.2) | |
463 | m.Parent = pm2 | |
464 | local w = Instance.new("Weld") | |
465 | w.Part0 = pm2 | |
466 | w.Part1 = pm | |
467 | w.C0 = CFrame.new(0, 0.3, 0) | |
468 | w.C1 = CFrame.new() | |
469 | w.Parent = pm2 | |
470 | local f = Instance.new("Fire") | |
471 | f.Enabled = false | |
472 | f.Name = "Fire" | |
473 | f.Color = Color3.new(1, 0.5, 0) | |
474 | f.SecondaryColor = Color3.new(1, 0.75, 0.5) | |
475 | f.Heat = 25 | |
476 | f.Size = 1 | |
477 | f.Parent = pm2 | |
478 | local s = Instance.new("Smoke") | |
479 | s.Enabled = false | |
480 | s.Name = "Smoke" | |
481 | s.Opacity = 0.25 | |
482 | s.Color = Color3.new(0.8, 0.8, 0.8) | |
483 | s.RiseVelocity = 10 | |
484 | s.Size = 5 | |
485 | s.Parent = pm2 | |
486 | local p = Instance.new("Part") | |
487 | if magazine.Value <= 0 then p.Transparency = 1 end | |
488 | p.Name = "Projectile Center 1" | |
489 | p.FormFactor = "Custom" | |
490 | p.Size = Vector3.new(1, 1, 1) | |
491 | p.BrickColor = BrickColor.new("Bright red") | |
492 | p.CanCollide = false | |
493 | p.Locked = true | |
494 | p.TopSurface = 0 | |
495 | p.BottomSurface = 0 | |
496 | p.Parent = model | |
497 | local m = Instance.new("SpecialMesh") | |
498 | m.MeshType = "FileMesh" | |
499 | m.MeshId = "http://www.roblox.com/Asset/?id=1033714" --http://www.roblox.com/Asset/?id=1778999 | |
500 | m.Scale = Vector3.new(0.25, 1.25, 0.25) | |
501 | m.Parent = p | |
502 | local w = Instance.new("Weld") | |
503 | w.Part0 = p | |
504 | w.Part1 = pm2 | |
505 | w.C0 = CFrame.new(0, 0.65, 0) | |
506 | w.C1 = CFrame.new() | |
507 | w.Parent = p | |
508 | local p = Instance.new("Part") | |
509 | if magazine.Value <= 0 then p.Transparency = 1 end | |
510 | p.Name = "Projectile Center 2" | |
511 | p.FormFactor = "Custom" | |
512 | p.Size = Vector3.new(1, 1, 1) | |
513 | p.BrickColor = BrickColor.new("Bright red") | |
514 | p.CanCollide = false | |
515 | p.Locked = true | |
516 | p.TopSurface = 0 | |
517 | p.BottomSurface = 0 | |
518 | p.Parent = model | |
519 | local m = Instance.new("SpecialMesh") | |
520 | m.MeshType = "FileMesh" | |
521 | m.MeshId = "http://www.roblox.com/Asset/?id=1033714" --http://www.roblox.com/Asset/?id=1778999 | |
522 | m.Scale = Vector3.new(0.25, 1.1, 0.25) | |
523 | m.Parent = p | |
524 | local w = Instance.new("Weld") | |
525 | w.Part0 = p | |
526 | w.Part1 = pm2 | |
527 | w.C0 = CFrame.new(0, -1.53, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0) | |
528 | w.C1 = CFrame.new() | |
529 | w.Parent = p | |
530 | local p = Instance.new("Part") | |
531 | if magazine.Value <= 0 then p.Transparency = 1 end | |
532 | p.Name = "Projectile Tip" | |
533 | p.FormFactor = "Custom" | |
534 | p.Size = Vector3.new(1, 1, 1) | |
535 | p.BrickColor = BrickColor.new("Bright red") | |
536 | p.CanCollide = false | |
537 | p.Locked = true | |
538 | p.TopSurface = 0 | |
539 | p.BottomSurface = 0 | |
540 | p.Parent = model | |
541 | local m = Instance.new("CylinderMesh") | |
542 | m.Scale = Vector3.new(0.1, 0.1, 0.1) | |
543 | m.Parent = p | |
544 | local w = Instance.new("Weld") | |
545 | w.Part0 = p | |
546 | w.Part1 = pm2 | |
547 | w.C0 = CFrame.new(0, 1.89, 0) | |
548 | w.C1 = CFrame.new() | |
549 | w.Parent = p | |
550 | return model | |
551 | end | |
552 | ||
553 | ||
554 | function removeParts(format) | |
555 | if format == "RightHand" then | |
556 | pcall(function() Player.Character[Name]:Remove() end) | |
557 | elseif format == "LeftHand" then | |
558 | pcall(function() Player.Character[Name.. " (Left)"]:Remove() end) | |
559 | elseif format == "RightHolster" then | |
560 | pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end) | |
561 | elseif format == "LeftHolster" then | |
562 | pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end) | |
563 | end | |
564 | end | |
565 | ||
566 | ||
567 | function SetAngle(Joint, Angle, Character) | |
568 | if Character == nil then return false end | |
569 | local Joints = { | |
570 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
571 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
572 | Character.Torso:FindFirstChild("Right Hip 2"), | |
573 | Character.Torso:FindFirstChild("Left Hip 2") | |
574 | } | |
575 | if Joints[Joint] == nil then return false end | |
576 | if Joint == 1 or Joint == 3 then | |
577 | Joints[Joint].DesiredAngle = Angle | |
578 | end | |
579 | if Joint == 2 or Joint == 4 then | |
580 | Joints[Joint].DesiredAngle = -Angle | |
581 | end | |
582 | end | |
583 | ||
584 | ||
585 | function ForceAngle(Joint, Angle, Character) | |
586 | if Character == nil then return false end | |
587 | local Joints = { | |
588 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
589 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
590 | Character.Torso:FindFirstChild("Right Hip 2"), | |
591 | Character.Torso:FindFirstChild("Left Hip 2") | |
592 | } | |
593 | if Joints[Joint] == nil then return false end | |
594 | if Joint == 1 or Joint == 3 then | |
595 | Joints[Joint].DesiredAngle = Angle | |
596 | Joints[Joint].CurrentAngle = Angle | |
597 | end | |
598 | if Joint == 2 or Joint == 4 then | |
599 | Joints[Joint].DesiredAngle = -Angle | |
600 | Joints[Joint].CurrentAngle = -Angle | |
601 | end | |
602 | end | |
603 | ||
604 | ||
605 | function SetSpeed(Joint, Speed, Character) | |
606 | if Character == nil then return false end | |
607 | local Joints = { | |
608 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
609 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
610 | Character.Torso:FindFirstChild("Right Hip 2"), | |
611 | Character.Torso:FindFirstChild("Left Hip 2") | |
612 | } | |
613 | if Joints[Joint] == nil then return false end | |
614 | Joints[Joint].MaxVelocity = Speed | |
615 | end | |
616 | ||
617 | ||
618 | function DisableLimb(Limb, Character) | |
619 | if Character == nil then return false end | |
620 | if Character:FindFirstChild("Torso") == nil then return false end | |
621 | local Joints = { | |
622 | Character.Torso:FindFirstChild("Right Shoulder"), | |
623 | Character.Torso:FindFirstChild("Left Shoulder"), | |
624 | Character.Torso:FindFirstChild("Right Hip"), | |
625 | Character.Torso:FindFirstChild("Left Hip") | |
626 | } | |
627 | local Limbs = { | |
628 | Character:FindFirstChild("Right Arm"), | |
629 | Character:FindFirstChild("Left Arm"), | |
630 | Character:FindFirstChild("Right Leg"), | |
631 | Character:FindFirstChild("Left Leg") | |
632 | } | |
633 | if Joints[Limb] == nil then return false end | |
634 | if Limbs[Limb] == nil then return false end | |
635 | local Joint = Instance.new("Motor") | |
636 | Joint.Parent = Character.Torso | |
637 | Joint.Part0 = Character.Torso | |
638 | Joint.Part1 = Limbs[Limb] | |
639 | if Limb == 1 then | |
640 | Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
641 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
642 | Joint.Name = "Right Shoulder 2" | |
643 | elseif Limb == 2 then | |
644 | Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
645 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
646 | Joint.Name = "Left Shoulder 2" | |
647 | elseif Limb == 3 then | |
648 | Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
649 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
650 | Joint.Name = "Right Hip 2" | |
651 | elseif Limb == 4 then | |
652 | Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
653 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
654 | Joint.Name = "Left Hip 2" | |
655 | end | |
656 | Joint.MaxVelocity = Joints[Limb].MaxVelocity | |
657 | Joint.CurrentAngle = Joints[Limb].CurrentAngle | |
658 | Joint.DesiredAngle = Joints[Limb].DesiredAngle | |
659 | Joints[Limb]:Remove() | |
660 | end | |
661 | ||
662 | ||
663 | function ResetLimbCFrame(Limb, Character) | |
664 | if Character == nil then return false end | |
665 | if Character.Parent == nil then return false end | |
666 | if Character:FindFirstChild("Torso") == nil then return false end | |
667 | local Joints = { | |
668 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
669 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
670 | Character.Torso:FindFirstChild("Right Hip 2"), | |
671 | Character.Torso:FindFirstChild("Left Hip 2") | |
672 | } | |
673 | local Limbs = { | |
674 | Character:FindFirstChild("Right Arm"), | |
675 | Character:FindFirstChild("Left Arm"), | |
676 | Character:FindFirstChild("Right Leg"), | |
677 | Character:FindFirstChild("Left Leg") | |
678 | } | |
679 | if Joints[Limb] == nil then return false end | |
680 | if Limbs[Limb] == nil then return false end | |
681 | if Limb == 1 then | |
682 | Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
683 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
684 | elseif Limb == 2 then | |
685 | Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
686 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
687 | elseif Limb == 3 then | |
688 | Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
689 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
690 | elseif Limb == 4 then | |
691 | Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
692 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
693 | end | |
694 | end | |
695 | ||
696 | ||
697 | function EnableLimb(Limb, Character) | |
698 | if Character == nil then return false end | |
699 | if Character:FindFirstChild("Torso") == nil then return false end | |
700 | local Joints = { | |
701 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
702 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
703 | Character.Torso:FindFirstChild("Right Hip 2"), | |
704 | Character.Torso:FindFirstChild("Left Hip 2") | |
705 | } | |
706 | local Limbs = { | |
707 | Character:FindFirstChild("Right Arm"), | |
708 | Character:FindFirstChild("Left Arm"), | |
709 | Character:FindFirstChild("Right Leg"), | |
710 | Character:FindFirstChild("Left Leg") | |
711 | } | |
712 | if Joints[Limb] == nil then return false end | |
713 | if Limbs[Limb] == nil then return false end | |
714 | if Limb == 1 then | |
715 | Joints[Limb].Name = "Right Shoulder" | |
716 | elseif Limb == 2 then | |
717 | Joints[Limb].Name = "Left Shoulder" | |
718 | elseif Limb == 3 then | |
719 | Joints[Limb].Name = "Right Hip" | |
720 | elseif Limb == 4 then | |
721 | Joints[Limb].Name = "Left Hip" | |
722 | end | |
723 | Animate = Character:FindFirstChild("Animate") | |
724 | if Animate == nil then return false end | |
725 | Animate = Animate:Clone() | |
726 | Character.Animate:Remove() | |
727 | Animate.Parent = Character | |
728 | end | |
729 | ||
730 | ||
731 | function playAnimation(format, mouse) | |
732 | if format == "equip" then | |
733 | coroutine.resume(coroutine.create(function() | |
734 | for i = 0, 1, 0.025 do | |
735 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
736 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
737 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i) | |
738 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0) | |
739 | else return false end | |
740 | else return false end | |
741 | wait() | |
742 | end | |
743 | end)) | |
744 | for i = 0, 1, 0.05 do | |
745 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
746 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
747 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, -0.25 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * i, 0, math.rad(-20) * i) | |
748 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) | |
749 | else return false end | |
750 | else return false end | |
751 | wait() | |
752 | end | |
753 | removeParts("RightHolster") | |
754 | makeParts("RightHand") | |
755 | for i = 0, 1, 0.05 do | |
756 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
757 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
758 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 * (1 - i), 0.5 * (1 - i), -0.25 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, math.rad(-20) * (1 - i)) * CFrame.new(1.25 * i, 0.5 * i, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, 0) | |
759 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i) | |
760 | else return false end | |
761 | else return false end | |
762 | if Player.Character:FindFirstChild(Name) ~= nil then | |
763 | if Player.Character[Name]:FindFirstChild("Handle") ~= nil then | |
764 | Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75) | |
765 | Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0) | |
766 | else return false end | |
767 | else return false end | |
768 | wait() | |
769 | end | |
770 | makeParts("RightHolster") | |
771 | removeParts("RightHand") | |
772 | return playAnimation("hold") | |
773 | end | |
774 | if format == "unequip" then | |
775 | coroutine.resume(coroutine.create(function() | |
776 | for i = 1, 0, -0.025 do | |
777 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
778 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
779 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i) | |
780 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0) | |
781 | else return false end | |
782 | else return false end | |
783 | wait() | |
784 | end | |
785 | end)) | |
786 | for i = 1, 0, -0.05 do | |
787 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
788 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
789 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 * (1 - i), 0.5 * (1 - i), -0.25 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, math.rad(-20) * (1 - i)) * CFrame.new(1.25 * i, 0.5 * i, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, 0) | |
790 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i) | |
791 | else return false end | |
792 | else return false end | |
793 | if Player.Character:FindFirstChild(Name) ~= nil then | |
794 | if Player.Character[Name]:FindFirstChild("Handle") ~= nil then | |
795 | Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75) | |
796 | Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0) | |
797 | else return false end | |
798 | else return false end | |
799 | wait() | |
800 | end | |
801 | makeParts("RightHolster") | |
802 | removeParts("RightHand") | |
803 | for i = 1, 0, -0.05 do | |
804 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
805 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
806 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, -0.25 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * i, 0, math.rad(-20) * i) | |
807 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) | |
808 | else return false end | |
809 | else return false end | |
810 | wait() | |
811 | end | |
812 | removeParts("RightHolster") | |
813 | makeParts("RightHand") | |
814 | return true | |
815 | end | |
816 | if format == "hold" then | |
817 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
818 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
819 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(67.5)) | |
820 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 1.85, 0) | |
821 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) | |
822 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.75, 0.1) | |
823 | else return false end | |
824 | else return false end | |
825 | end | |
826 | if format == "reload" then | |
827 | Player.Character[Name].Handle.Reload.Volume = 0 | |
828 | Player.Character[Name].Handle.Reload.Pitch = 1.78 | |
829 | Player.Character[Name].Handle.Reload:Play() | |
830 | coroutine.resume(coroutine.create(function() | |
831 | for i = 0, 1, 0.06 do | |
832 | if Player.Character:FindFirstChild("Torso") ~= nil and Player.Character:FindFirstChild(Name) ~= nil then | |
833 | if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil and Player.Character[Name]:FindFirstChild("Handle") ~= nil then | |
834 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25 + i / 10, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(i * 90)) | |
835 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.75, 0.1) | |
836 | Player.Character[Name].Handle.Weld.C1 = CFrame.new(0, -1.4 * i, 0) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-i * 170)) | |
837 | end | |
838 | end | |
839 | wait() | |
840 | end | |
841 | end)) | |
842 | for i = 1, 0, -0.1 do | |
843 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
844 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
845 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i) | |
846 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0) | |
847 | else return false end | |
848 | else return false end | |
849 | wait() | |
850 | end | |
851 | local projectile = Instance.new("Model") | |
852 | projectile.Name = Name.. " Projectile" | |
853 | local source = Player.Character[Name]:FindFirstChild("Projectile") | |
854 | if source == nil then return end | |
855 | source = source:Clone() | |
856 | source.Transparency = 0 | |
857 | source.Parent = projectile | |
858 | for _, Part in pairs(Player.Character[Name]:GetChildren()) do | |
859 | if string.match(Part.Name, "Projectile") and Part.Name ~= "Projectile" then | |
860 | local new = Part:Clone() | |
861 | new.Parent = projectile | |
862 | new.Transparency = 0 | |
863 | --new.CFrame = source.CFrame * (Part.Weld.C0 * Part.Weld.C1):inverse() | |
864 | local w = Instance.new("Weld", new) | |
865 | w.Part0 = w.Parent | |
866 | w.Part1 = source | |
867 | w.C0 = Part.Weld.C0 | |
868 | w.C1 = Part.Weld.C1 | |
869 | end | |
870 | end | |
871 | local w = Instance.new("Weld", source) | |
872 | w.Part0 = w.Parent | |
873 | w.Part1 = Player.Character:FindFirstChild("Left Arm") | |
874 | w.C0 = CFrame.new(0.2, -0.8, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, math.rad(-37.5)) | |
875 | projectile.Parent = Player.Character[Name] | |
876 | for i = 0, 1, 0.1 do | |
877 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
878 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
879 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(110) * i, 0, math.rad(67.5) * i) | |
880 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0.35 * i, 1.85 * i, 0) | |
881 | else return false end | |
882 | else return false end | |
883 | wait() | |
884 | end | |
885 | Player.Character[Name].Handle.Reload.Volume = 1 | |
886 | Player.Character[Name].Handle.Reload.Pitch = 0.9 | |
887 | for i = 0, 0.9, 0.1 do | |
888 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
889 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
890 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5 + i, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(110), 0, math.rad(67.5)) | |
891 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.35 * (1 - i), 1.85, 0) | |
892 | else return false end | |
893 | else return false end | |
894 | wait() | |
895 | end | |
896 | projectile:Remove() | |
897 | Player.Character[Name].Handle.Reload:Stop() | |
898 | for _, Part in pairs(Player.Character[Name]:GetChildren()) do | |
899 | if string.match(Part.Name, "Projectile") then | |
900 | Part.Transparency = 0 | |
901 | end | |
902 | end | |
903 | coroutine.resume(coroutine.create(function() | |
904 | for i = 1, 0, -0.1 do | |
905 | if Player.Character:FindFirstChild("Torso") ~= nil and Player.Character:FindFirstChild(Name) ~= nil then | |
906 | if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil and Player.Character[Name]:FindFirstChild("Handle") ~= nil then | |
907 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25 + i / 10, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(i * 90)) | |
908 | Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.75, 0.1) | |
909 | Player.Character[Name].Handle.Weld.C1 = CFrame.new(0, -1.4 * i, 0) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-i * 170)) | |
910 | end | |
911 | end | |
912 | wait() | |
913 | end | |
914 | end)) | |
915 | for i = 0.9, 0, -0.1 do | |
916 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
917 | if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then | |
918 | Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5 + i, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(110), 0, math.rad(67.5)) | |
919 | Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 1.85, 0) | |
920 | else return false end | |
921 | else return false end | |
922 | wait() | |
923 | end | |
924 | Player.Character[Name].Handle.Weld.C1 = CFrame.new() | |
925 | playAnimation("hold") | |
926 | return true | |
927 | end | |
928 | if format == "fire" then | |
929 | if Player.Character[Name]:FindFirstChild("Handle") ~= nil then | |
930 | Player.Character[Name].Handle.Fire:Play() | |
931 | CamShake(0.1, 5000) | |
932 | else return false end | |
933 | if Player.Character:FindFirstChild("Humanoid") ~= nil then | |
934 | coroutine.resume(coroutine.create(function() if Player.Character.Humanoid.PlatformStand == false and Player.Character.Humanoid.Sit == false then Player.Character.Humanoid.PlatformStand = true wait(0.1) Player.Character.Humanoid.PlatformStand = false end end)) | |
935 | else return false end | |
936 | if Player.Character:FindFirstChild("Torso") ~= nil then | |
937 | coroutine.resume(coroutine.create(function() Player.Character.Torso.Velocity = Player.Character.Torso.Velocity + (Player.Character.Torso.CFrame.lookVector * -100) + Vector3.new(0, 25, 0) end)) | |
938 | else return false end | |
939 | if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then | |
940 | coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.5) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end)) | |
941 | else return false end | |
942 | if Player.Character[Name]:FindFirstChild("End 2") ~= nil then | |
943 | coroutine.resume(coroutine.create(function() Player.Character[Name]["End 2"].Smoke.Enabled = true Player.Character[Name]["End 2"].Fire.Enabled = true wait(0.5) Player.Character[Name]["End 2"].Smoke.Enabled = false Player.Character[Name]["End 2"].Fire.Enabled = false end)) | |
944 | else return false end | |
945 | end | |
946 | return true | |
947 | end | |
948 | ||
949 | ||
950 | function CamShake(time, freq) | |
951 | coroutine.resume(coroutine.create(function() | |
952 | local cam = Workspace.CurrentCamera | |
953 | local time = 10 | |
954 | local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0) | |
955 | if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end | |
956 | if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end | |
957 | 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) | |
958 | for i = 1, time do | |
959 | 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) | |
960 | wait() | |
961 | end | |
962 | end)) | |
963 | end | |
964 | ||
965 | ||
966 | function Weld(x, y) | |
967 | local weld = Instance.new("Weld") | |
968 | weld.Part0 = x | |
969 | weld.Part1 = y | |
970 | CJ = CFrame.new(x.Position) | |
971 | C0 = x.CFrame:inverse() * CJ | |
972 | C1 = y.CFrame:inverse() * CJ | |
973 | weld.C0 = C0 | |
974 | weld.C1 = C1 | |
975 | weld.Parent = x | |
976 | end | |
977 | ||
978 | ||
979 | function tagHumanoid(humanoid) | |
980 | local tag = Instance.new("ObjectValue") | |
981 | tag.Name = "creator" | |
982 | tag.Value = Player | |
983 | tag.Parent = humanoid | |
984 | local tag = Instance.new("StringValue") | |
985 | tag.Name = "creatorType1" | |
986 | tag.Value = Name | |
987 | tag.Parent = humanoid | |
988 | local tag = Instance.new("StringValue") | |
989 | tag.Name = "creatorType2" | |
990 | tag.Value = "blown to bits" | |
991 | tag.Parent = humanoid | |
992 | end | |
993 | ||
994 | ||
995 | function untagHumanoid(humanoid) | |
996 | if humanoid ~= nil then | |
997 | local tag = humanoid:FindFirstChild("creator") | |
998 | if tag ~= nil then | |
999 | tag:Remove() | |
1000 | end | |
1001 | local tag = humanoid:FindFirstChild("creatorType1") | |
1002 | if tag ~= nil then | |
1003 | tag:Remove() | |
1004 | end | |
1005 | local tag = humanoid:FindFirstChild("creatorType2") | |
1006 | if tag ~= nil then | |
1007 | tag:Remove() | |
1008 | end | |
1009 | end | |
1010 | end | |
1011 | ||
1012 | ||
1013 | function fire(startPoint, endPoint, hit) | |
1014 | local projectile = Instance.new("Model") | |
1015 | projectile.Name = Name.. " Projectile" | |
1016 | local source = Player.Character[Name]:FindFirstChild("Projectile") | |
1017 | if source == nil then return end | |
1018 | source.Transparency = 1 | |
1019 | source = source:Clone() | |
1020 | source.Transparency = 0 | |
1021 | source.CanCollide = false | |
1022 | pcall(function() source.Fire.Enabled = true end) | |
1023 | pcall(function() source.Smoke.Enabled = true end) | |
1024 | source.CFrame = CFrame.new(startPoint, endPoint) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) | |
1025 | source.Parent = projectile | |
1026 | for _, Part in pairs(Player.Character[Name]:GetChildren()) do | |
1027 | if string.match(Part.Name, "Projectile") and Part.Name ~= "Projectile" then | |
1028 | local new = Part:Clone() | |
1029 | new.Parent = projectile | |
1030 | new.Transparency = 0 | |
1031 | new.CFrame = source.CFrame * (Part.Weld.C0 * Part.Weld.C1):inverse() | |
1032 | local w = Instance.new("Weld", new) | |
1033 | w.Part0 = w.Parent | |
1034 | w.Part1 = source | |
1035 | w.C0 = Part.Weld.C0 | |
1036 | w.C1 = Part.Weld.C1 | |
1037 | Part.Transparency = 1 | |
1038 | end | |
1039 | end | |
1040 | projectile.Parent = Workspace | |
1041 | local vel = Instance.new("BodyVelocity") | |
1042 | vel.maxForce = Vector3.new(math.huge, math.huge, math.huge) | |
1043 | vel.velocity = (endPoint - startPoint).unit * 100 | |
1044 | vel.Parent = source | |
1045 | local gyro = Instance.new("BodyGyro") | |
1046 | gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge) | |
1047 | gyro.cframe = CFrame.new(startPoint, endPoint) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) | |
1048 | gyro.Parent = source | |
1049 | coroutine.resume(coroutine.create(function() wait(1) gyro:Remove() end)) | |
1050 | wait(0.2) | |
1051 | source.CanCollide = true | |
1052 | local connection = nil | |
1053 | connection = source.Touched:connect(function() | |
1054 | if hit.Parent == nil then return end | |
1055 | if hit.Parent == projectile then return end | |
1056 | if hit.Parent == Player.Character then return end | |
1057 | if hit.Parent == Player.Character:FindFirstChild(Name) then return end | |
1058 | if hit.Parent.Parent == Player.Character then return end | |
1059 | for i = 1, math.random(3, 6) do | |
1060 | local s = Instance.new("Sound", source) | |
1061 | s.SoundId = "http://www.roblox.com/Asset/?id=2101148" | |
1062 | s.Volume = 1 | |
1063 | s.Pitch = math.random(1, 10) / 10 | |
1064 | s:Play() | |
1065 | end | |
1066 | coroutine.resume(coroutine.create(function() | |
1067 | pcall(function() vel:Remove() end) | |
1068 | for _, Part in pairs(projectile:GetChildren()) do | |
1069 | if Part.Name ~= "Projectile" then | |
1070 | Part:Remove() | |
1071 | else | |
1072 | Part.Anchored = true | |
1073 | Part.Transparency = 1 | |
1074 | Part.CanCollide = false | |
1075 | pcall(function() Part.Fire.Enabled = false end) | |
1076 | pcall(function() Part.Smoke.Enabled = false end) | |
1077 | end | |
1078 | end | |
1079 | connection:disconnect() | |
1080 | wait(5) | |
1081 | projectile:Remove() | |
1082 | end)) | |
1083 | local range = damage / 5 | |
1084 | local power = damage / 2 | |
1085 | local function Push(Part) | |
1086 | if #Part:GetChildren() > 0 then for _, Parts in pairs(Part:GetChildren()) do Push(Parts) end end | |
1087 | if pcall(function() local x = Part.CFrame end) == false then return end | |
1088 | if Part.Anchored == true then return end | |
1089 | if (Part.Position - source.Position).magnitude > range then return end | |
1090 | Part.Velocity = Part.Velocity + ((Part.Position - source.Position).unit * power) | |
1091 | coroutine.wrap(function() | |
1092 | if Part.Parent:FindFirstChild("Humanoid") ~= nil then | |
1093 | Part.Parent.Humanoid:TakeDamage(1000000) --Set to damage of explosion | |
1094 | end | |
1095 | end)() | |
1096 | end | |
1097 | Push(Workspace) | |
1098 | for i = 1, math.random(5, 20) do | |
1099 | local blast = Instance.new("Part") | |
1100 | blast.FormFactor = 0 | |
1101 | blast.Size = Vector3.new(1, 1, 1) | |
1102 | local color = math.random(1, 4) | |
1103 | if color == 1 then | |
1104 | blast.BrickColor = BrickColor.new("Really red") | |
1105 | elseif color == 2 then | |
1106 | blast.BrickColor = BrickColor.new("Bright orange") | |
1107 | elseif color == 3 then | |
1108 | blast.BrickColor = BrickColor.new("Neon orange") | |
1109 | elseif color == 4 then | |
1110 | blast.BrickColor = BrickColor.new("Bright red") | |
1111 | end | |
1112 | blast.TopSurface = 0 | |
1113 | blast.BottomSurface = 0 | |
1114 | blast.Anchored = true | |
1115 | blast.CanCollide = false | |
1116 | blast.CFrame = source.CFrame * CFrame.new(math.random(-damage / 50, damage / 50), math.random(-damage / 50, damage / 50), math.random(-damage / 50, damage / 50)) | |
1117 | blast.Parent = Workspace | |
1118 | local mesh = Instance.new("SpecialMesh") | |
1119 | mesh.MeshType = "Sphere" | |
1120 | mesh.Parent = blast | |
1121 | coroutine.resume(coroutine.create(function() | |
1122 | for i = 1, range, math.random(range, range + 100) / 100 do | |
1123 | blast.Transparency = i / range | |
1124 | mesh.Scale = Vector3.new(i, i, i) | |
1125 | wait() | |
1126 | end | |
1127 | blast:Remove() | |
1128 | end)) | |
1129 | end | |
1130 | end) | |
1131 | coroutine.resume(coroutine.create(function() | |
1132 | wait(10) | |
1133 | for _, Part in pairs(projectile:GetChildren()) do | |
1134 | Part.CanCollide = false | |
1135 | end | |
1136 | pcall(function() source.Fire.Enabled = false end) | |
1137 | pcall(function() source.Smoke.Enabled = false end) | |
1138 | pcall(function() vel:Remove() end) | |
1139 | pcall(function() connection:disconnect() end) | |
1140 | end)) | |
1141 | end | |
1142 | ||
1143 | ||
1144 | function onButton1Down(mouse) | |
1145 | if selected == false then return end | |
1146 | 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 | |
1147 | if Player.Character[Name]:FindFirstChild("Handle") == nil then return end | |
1148 | if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end | |
1149 | if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end | |
1150 | if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end | |
1151 | mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" | |
1152 | Button1Down = true | |
1153 | canFire = false | |
1154 | canFire2 = true | |
1155 | while canFire2 == true do | |
1156 | local humanoid = Player.Character:FindFirstChild("Humanoid") | |
1157 | if humanoid == nil then | |
1158 | canFire2 = false | |
1159 | break | |
1160 | end | |
1161 | if humanoid.Health <= 0 then | |
1162 | canFire2 = false | |
1163 | break | |
1164 | end | |
1165 | local fireLeft = false | |
1166 | if automatic == false and burst == false then | |
1167 | canFire2 = false | |
1168 | elseif automatic == false and burst == true then | |
1169 | if burstCount >= burstCountMax then | |
1170 | canFire2 = false | |
1171 | burstCount = 0 | |
1172 | break | |
1173 | end | |
1174 | burstCount = burstCount + 1 | |
1175 | elseif automatic == true and burst == false then | |
1176 | fireLeft = true | |
1177 | end | |
1178 | if magazine.Value > 0 then | |
1179 | magazine.Value = magazine.Value - 1 | |
1180 | updateGui() | |
1181 | fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target) | |
1182 | coroutine.resume(coroutine.create(function() | |
1183 | if dual == true then | |
1184 | playAnimation("rightFire") | |
1185 | elseif dual == false then | |
1186 | playAnimation("fire") | |
1187 | end | |
1188 | end)) | |
1189 | else | |
1190 | Player.Character[Name].Handle.Empty:Play() | |
1191 | end | |
1192 | if fireLeft == true and dual == true and automatic == true then | |
1193 | if magazine.Value > 0 then | |
1194 | coroutine.resume(coroutine.create(function() | |
1195 | wait(readyTime / 2) | |
1196 | magazine.Value = magazine.Value - 1 | |
1197 | updateGui() | |
1198 | fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target) | |
1199 | playAnimation("leftFire") | |
1200 | end)) | |
1201 | else | |
1202 | coroutine.resume(coroutine.create(function() | |
1203 | wait(readyTime / 2) | |
1204 | Player.Character[Name].Handle.Empty:Play() | |
1205 | end)) | |
1206 | end | |
1207 | end | |
1208 | wait(readyTime) | |
1209 | end | |
1210 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
1211 | canFire = true | |
1212 | end | |
1213 | end | |
1214 | ||
1215 | ||
1216 | function onButton1Up(mouse) | |
1217 | if selected == false then return end | |
1218 | Button1Down = false | |
1219 | canFire2 = false | |
1220 | burstCount = 0 | |
1221 | while canFire == false do wait() end | |
1222 | if dual == true and automatic == false then | |
1223 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end | |
1224 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end | |
1225 | mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" | |
1226 | canFire = false | |
1227 | canFire2 = true | |
1228 | while canFire2 == true do | |
1229 | local humanoid = Player.Character:FindFirstChild("Humanoid") | |
1230 | if humanoid == nil then | |
1231 | canFire2 = false | |
1232 | break | |
1233 | end | |
1234 | if humanoid.Health <= 0 then | |
1235 | canFire2 = false | |
1236 | break | |
1237 | end | |
1238 | if burst == false then | |
1239 | canFire2 = false | |
1240 | elseif burst == true then | |
1241 | if burstCount >= burstCountMax then | |
1242 | canFire2 = false | |
1243 | burstCount = 0 | |
1244 | break | |
1245 | end | |
1246 | burstCount = burstCount + 1 | |
1247 | end | |
1248 | if magazine.Value <= 0 then | |
1249 | Player.Character[Name].Handle.Empty:Play() | |
1250 | else | |
1251 | coroutine.resume(coroutine.create(function() | |
1252 | playAnimation("leftFire") | |
1253 | end)) | |
1254 | magazine.Value = magazine.Value - 1 | |
1255 | updateGui() | |
1256 | fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target) | |
1257 | end | |
1258 | wait(readyTime) | |
1259 | end | |
1260 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
1261 | canFire = true | |
1262 | end | |
1263 | end | |
1264 | ||
1265 | ||
1266 | function onKeyDown(key, mouse) | |
1267 | if selected == false then return end | |
1268 | key = key:lower() | |
1269 | if key == "q" and Button1Down == false and canFire == true then | |
1270 | if mouse.Target == nil then return end | |
1271 | if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then | |
1272 | if dual == true then onKeyDown("t", mouse) end | |
1273 | onDeselected(mouse) | |
1274 | removeParts("RightHolster") | |
1275 | script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack | |
1276 | end | |
1277 | end | |
1278 | if key == "e" and Button1Down == false and canFire == true and canSilence == true then | |
1279 | if silenced then | |
1280 | silenced = false | |
1281 | if Player.Character:FindFirstChild(Name) == nil then return end | |
1282 | if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end | |
1283 | if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end | |
1284 | Player.Character[Name].Muzzle.Transparency = 1 | |
1285 | Player.Character[Name].Muzzle.Name = "Silencer" | |
1286 | Player.Character[Name]["Muzzle 2"].Name = "Muzzle" | |
1287 | if dual == true then | |
1288 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end | |
1289 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end | |
1290 | Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1 | |
1291 | Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer" | |
1292 | Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle" | |
1293 | end | |
1294 | else | |
1295 | silenced = true | |
1296 | if Player.Character:FindFirstChild(Name) == nil then return end | |
1297 | if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end | |
1298 | if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end | |
1299 | Player.Character[Name].Silencer.Transparency = 0 | |
1300 | Player.Character[Name].Muzzle.Name = "Muzzle 2" | |
1301 | Player.Character[Name].Silencer.Name = "Muzzle" | |
1302 | if dual == true then | |
1303 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end | |
1304 | if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end | |
1305 | Player.Character[Name.. " (Left)"].Silencer.Transparency = 0 | |
1306 | Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2" | |
1307 | Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle" | |
1308 | end | |
1309 | end | |
1310 | end | |
1311 | if key == "r" and Button1Down == false and canFire == true then | |
1312 | if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then | |
1313 | canFire = false | |
1314 | burstCount = 0 | |
1315 | mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" | |
1316 | if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end | |
1317 | updateGui() | |
1318 | if dual == true then | |
1319 | playAnimation("reloadDual") | |
1320 | elseif dual == false then | |
1321 | playAnimation("reload") | |
1322 | end | |
1323 | if ammo.Value - magazineMax.Value < 0 then | |
1324 | magazine.Value = ammo.Value | |
1325 | ammo.Value = 0 | |
1326 | elseif ammo.Value - magazineMax.Value >= 0 then | |
1327 | ammo.Value = ammo.Value - magazineMax.Value | |
1328 | magazine.Value = magazineMax.Value | |
1329 | end | |
1330 | updateGui() | |
1331 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
1332 | canFire = true | |
1333 | end | |
1334 | end | |
1335 | if key == "t" and Button1Down == false and canFire == true and canDual == true then | |
1336 | canFire = false | |
1337 | if dual == false then | |
1338 | local weapon = nil | |
1339 | for _, p in pairs(Player.Backpack:GetChildren()) do | |
1340 | if p.Name == Name and p ~= script.Parent then weapon = p break end | |
1341 | end | |
1342 | if weapon ~= nil then | |
1343 | dual = true | |
1344 | weapon.Name = "Dual" | |
1345 | weapon.Parent = script | |
1346 | silenced = false | |
1347 | removeParts("RightHand") | |
1348 | makeParts("RightHand") | |
1349 | removeParts("RightHolster") | |
1350 | makeParts("LeftHolster") | |
1351 | playAnimation("leftEquip") | |
1352 | removeParts("LeftHolster") | |
1353 | makeParts("LeftHand") | |
1354 | magazineMax.Value = math.ceil(magazineMax.Value * 2) | |
1355 | ammoMax.Value = math.ceil(ammoMax.Value * 2) | |
1356 | magazine.Value = magazine.Value + weapon.Magazine.Value | |
1357 | ammo.Value = ammo.Value + weapon.Ammo.Value | |
1358 | updateGui() | |
1359 | end | |
1360 | elseif dual == true then | |
1361 | local weapon = script:FindFirstChild("Dual") | |
1362 | if weapon ~= nil then | |
1363 | dual = false | |
1364 | weapon.Name = Name | |
1365 | weapon.Parent = Player.Backpack | |
1366 | silenced = false | |
1367 | removeParts("RightHand") | |
1368 | makeParts("RightHand") | |
1369 | playAnimation("leftUnequip") | |
1370 | removeParts("LeftHand") | |
1371 | makeParts("RightHolster") | |
1372 | playAnimation("hold") | |
1373 | weapon.Magazine.Value = math.floor(magazine.Value / 2) | |
1374 | weapon.Ammo.Value = math.floor(ammo.Value / 2) | |
1375 | magazineMax.Value = math.ceil(magazineMax.Value / 2) | |
1376 | ammoMax.Value = math.ceil(ammoMax.Value / 2) | |
1377 | magazine.Value = math.ceil(magazine.Value / 2) | |
1378 | ammo.Value = math.ceil(ammo.Value / 2) | |
1379 | updateGui() | |
1380 | end | |
1381 | end | |
1382 | canFire = true | |
1383 | end | |
1384 | if key == "y" and canZoom == true then | |
1385 | if zoom == false then | |
1386 | zoom = true | |
1387 | local pos = mouse.Hit.p | |
1388 | local target = mouse.Target | |
1389 | local cam = Workspace.CurrentCamera | |
1390 | focus = Instance.new("Part", Workspace) | |
1391 | focus.Anchored = true | |
1392 | focus.CanCollide = false | |
1393 | focus.Transparency = 1 | |
1394 | focus.TopSurface = 0 | |
1395 | focus.BottomSurface = 0 | |
1396 | focus.FormFactor = "Plate" | |
1397 | focus.Size = Vector3.new(0, 0, 0) | |
1398 | focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p) | |
1399 | cam.CameraSubject = focus | |
1400 | cam.CameraType = "Attach" | |
1401 | while zoom == true and selected == true do | |
1402 | local set = false | |
1403 | if target ~= nil then | |
1404 | if target.Parent ~= nil then | |
1405 | if target.Anchored == false then | |
1406 | focus.CFrame = CFrame.new(target.Position) * (CFrame.new(Player.Character.Torso.Position, target.Position) - CFrame.new(Player.Character.Torso.Position, target.Position).p) | |
1407 | set = true | |
1408 | end | |
1409 | end | |
1410 | end | |
1411 | if set == false then | |
1412 | focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p) | |
1413 | end | |
1414 | wait() | |
1415 | end | |
1416 | if focus ~= nil then focus:Remove() focus = nil end | |
1417 | local cam = Workspace.CurrentCamera | |
1418 | cam.CameraSubject = Player.Character:FindFirstChild("Humanoid") | |
1419 | cam.CameraType = "Custom" | |
1420 | else | |
1421 | zoom = false | |
1422 | end | |
1423 | end | |
1424 | if key == "u" and Button1Down == false and canFire == true then | |
1425 | if automatic == false and burst == false then | |
1426 | if switchToBurst == true then | |
1427 | burst = true | |
1428 | local m = Instance.new("Message", Player) | |
1429 | m.Text = "Burst" | |
1430 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1431 | delay(2.5, function() m:Remove() end) | |
1432 | elseif switchToAutomatic == true then | |
1433 | automatic = true | |
1434 | local m = Instance.new("Message", Player) | |
1435 | m.Text = "Automatic" | |
1436 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1437 | delay(2.5, function() m:Remove() end) | |
1438 | end | |
1439 | elseif automatic == false and burst == true then | |
1440 | if switchToAutomatic == true then | |
1441 | automatic = true | |
1442 | burst = false | |
1443 | local m = Instance.new("Message", Player) | |
1444 | m.Text = "Automatic" | |
1445 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1446 | delay(2.5, function() m:Remove() end) | |
1447 | elseif switchToSingle == true then | |
1448 | burst = false | |
1449 | local m = Instance.new("Message", Player) | |
1450 | m.Text = "Single" | |
1451 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1452 | delay(2.5, function() m:Remove() end) | |
1453 | end | |
1454 | elseif automatic == true and burst == false then | |
1455 | if switchToSingle == true then | |
1456 | automatic = false | |
1457 | local m = Instance.new("Message", Player) | |
1458 | m.Text = "Single" | |
1459 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1460 | delay(2.5, function() m:Remove() end) | |
1461 | elseif switchToBurst == true then | |
1462 | automatic = false | |
1463 | burst = true | |
1464 | local m = Instance.new("Message", Player) | |
1465 | m.Text = "Burst" | |
1466 | pcall(function() Player.Character[Name].Handle.Switch:Play() end) | |
1467 | delay(2.5, function() m:Remove() end) | |
1468 | end | |
1469 | end | |
1470 | end | |
1471 | end | |
1472 | ||
1473 | ||
1474 | function onSelected(mouse) | |
1475 | if selected == true then return end | |
1476 | selected = true | |
1477 | canFire = false | |
1478 | mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" | |
1479 | while Player.Character:FindFirstChild("WeaponActivated") ~= nil do | |
1480 | if Player.Character.WeaponActivated.Value == nil then break end | |
1481 | if Player.Character.WeaponActivated.Value.Parent == nil then break end | |
1482 | wait() | |
1483 | end | |
1484 | updateGui() | |
1485 | local weapon = Instance.new("ObjectValue") | |
1486 | weapon.Name = "WeaponActivated" | |
1487 | weapon.Value = script.Parent | |
1488 | weapon.Parent = Player.Character | |
1489 | DisableLimb(1, Player.Character) | |
1490 | DisableLimb(2, Player.Character) | |
1491 | ForceAngle(1, 0, Player.Character) | |
1492 | ForceAngle(2, 0, Player.Character) | |
1493 | if dual == true then | |
1494 | coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end)) | |
1495 | playAnimation("rightEquip") | |
1496 | removeParts("LeftHolster") | |
1497 | makeParts("LeftHand") | |
1498 | else | |
1499 | playAnimation("equip") | |
1500 | end | |
1501 | removeParts("RightHolster") | |
1502 | makeParts("RightHand") | |
1503 | mouse.Button1Down:connect(function() onButton1Down(mouse) end) | |
1504 | mouse.Button1Up:connect(function() onButton1Up(mouse) end) | |
1505 | mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end) | |
1506 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
1507 | canFire = true | |
1508 | end | |
1509 | ||
1510 | ||
1511 | function onDeselected(mouse) | |
1512 | if selected == false then return end | |
1513 | Button1Down = false | |
1514 | while canFire == false do | |
1515 | wait() | |
1516 | end | |
1517 | selected = false | |
1518 | if dual == true then | |
1519 | if math.random(1, 2) == 1 then | |
1520 | coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end)) | |
1521 | wait(math.random(1, 10) / 10) | |
1522 | playAnimation("rightUnequip") | |
1523 | else | |
1524 | coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end)) | |
1525 | wait(math.random(1, 10) / 10) | |
1526 | playAnimation("leftUnequip") | |
1527 | end | |
1528 | removeParts("LeftHand") | |
1529 | makeParts("LeftHolster") | |
1530 | else | |
1531 | playAnimation("unequip") | |
1532 | end | |
1533 | removeParts("RightHand") | |
1534 | makeParts("RightHolster") | |
1535 | ForceAngle(1, 0, Player.Character) | |
1536 | ForceAngle(2, 0, Player.Character) | |
1537 | ResetLimbCFrame(1, Player.Character) | |
1538 | ResetLimbCFrame(2, Player.Character) | |
1539 | EnableLimb(1, Player.Character) | |
1540 | EnableLimb(2, Player.Character) | |
1541 | silenced = false | |
1542 | if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end | |
1543 | if Player.Character:FindFirstChild("WeaponActivated") ~= nil then | |
1544 | if Player.Character.WeaponActivated.Value == script.Parent then | |
1545 | Player.Character.WeaponActivated:Remove() | |
1546 | end | |
1547 | end | |
1548 | while Player.Character:FindFirstChild("WeaponActivated") ~= nil do | |
1549 | if Player.Character.WeaponActivated.Value == nil then break end | |
1550 | if Player.Character.WeaponActivated.Value.Parent == nil then break end | |
1551 | wait() | |
1552 | end | |
1553 | end | |
1554 | ||
1555 | ||
1556 | if script.Parent.ClassName ~= "HopperBin" then | |
1557 | if Player == nil then print("Error: Player not found!") return end | |
1558 | Tool = Instance.new("HopperBin") | |
1559 | Tool.Name = Name | |
1560 | Tool.Parent = Player.Backpack | |
1561 | script.Name = "Main" | |
1562 | script.Parent = Tool | |
1563 | elseif script.Parent.ClassName == "HopperBin" then | |
1564 | while script.Parent.Parent.ClassName ~= "Backpack" do | |
1565 | wait() | |
1566 | end | |
1567 | if script.Parent:FindFirstChild("MagazineMax") == nil then | |
1568 | magazineMax = Instance.new("NumberValue") | |
1569 | magazineMax.Name = "MagazineMax" | |
1570 | magazineMax.Value = 3 | |
1571 | magazineMax.Parent = script.Parent | |
1572 | else | |
1573 | magazineMax = script.Parent.MagazineMax | |
1574 | end | |
1575 | if script.Parent:FindFirstChild("Magazine") == nil then | |
1576 | magazine = Instance.new("NumberValue") | |
1577 | magazine.Name = "Magazine" | |
1578 | magazine.Value = 3 | |
1579 | magazine.Parent = script.Parent | |
1580 | else | |
1581 | magazine = script.Parent.Magazine | |
1582 | end | |
1583 | if script.Parent:FindFirstChild("AmmoMax") == nil then | |
1584 | ammoMax = Instance.new("NumberValue") | |
1585 | ammoMax.Name = "AmmoMax" | |
1586 | ammoMax.Value = 50 --You may set the ammo of the RPG here. | |
1587 | ammoMax.Parent = script.Parent | |
1588 | else | |
1589 | ammoMax = script.Parent.AmmoMax | |
1590 | end | |
1591 | if script.Parent:FindFirstChild("Ammo") == nil then | |
1592 | ammo = Instance.new("NumberValue") | |
1593 | ammo.Name = "Ammo" | |
1594 | ammo.Value = script.Parent.AmmoMax.Value | |
1595 | ammo.Parent = script.Parent | |
1596 | else | |
1597 | ammo = script.Parent.Ammo | |
1598 | end | |
1599 | Player = script.Parent.Parent.Parent | |
1600 | makeParts("RightHolster") | |
1601 | script.Parent.Selected:connect(onSelected) | |
1602 | script.Parent.Deselected:connect(onDeselected) | |
1603 | end | |
1604 | --lego | |
1605 | game.Workspace.mogoon.Humanoid.MaxHealth = math.thesuperfireguy9000 | |
1606 | print(lego) |