SHOW:
|
|
- or go back to the newest paste.
1 | Players = game:GetService("Players") | |
2 | - | Me = Players.ares200345 |
2 | + | Me = Players.GamingStudios1029 |
3 | Char = Me.Character | |
4 | necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
5 | Asset = "http://www.roblox.com/asset/?id=" | |
6 | EffectModel = nil | |
7 | MeleeDmg = 123123141 | |
8 | Accuracy = {Minimum = 2, Maximum = 5.5, Momentum = 2} | |
9 | Selected = false | |
10 | ReloadFlash = false | |
11 | Attacking = false | |
12 | ReloadHold = false | |
13 | Reloading = false | |
14 | Swinging = false | |
15 | Aiming = false | |
16 | ReloadOn = false | |
17 | Debounce = true | |
18 | Hurt = false | |
19 | ModelName = "Weapon" | |
20 | ToolName = "Weapon" | |
21 | Icon = Asset..(58334502) | |
22 | ||
23 | function ReNew() | |
24 | if EffectModel then | |
25 | if EffectModel.Parent ~= workspace then | |
26 | pcall(function() EffectModel:remove() end) | |
27 | EffectModel = Instance.new("Model",workspace) | |
28 | EffectModel.Name = "Effects" | |
29 | end | |
30 | else | |
31 | EffectModel = Instance.new("Model",workspace) | |
32 | EffectModel.Name = "Effects" | |
33 | end | |
34 | end | |
35 | ||
36 | Ammunition = { | |
37 | MaxAmmo = 8, | |
38 | Ammo = 0, | |
39 | Ammoleft = 40, | |
40 | } | |
41 | ||
42 | Images = { | |
43 | Asset..(64291927), | |
44 | Asset..(64291941), | |
45 | Asset..(64291961), | |
46 | Asset..(64291977), | |
47 | } | |
48 | ||
49 | Sounds = { | |
50 | Fire = {Id = Asset..(2697294), Pitch = 0.92, Volume = 0.8}, | |
51 | Reload = {Id = Asset..(2697295), Pitch = 1, Volume = 0.5}, | |
52 | Slash = {Id = "rbxasset://sounds//swordslash.wav", Pitch = 1.2, Volume = 0.6}, | |
53 | Out = {Id = "rbxasset://sounds\\clickfast.wav", Pitch = 1.4, Volume = 0.6}, | |
54 | Hit = {Id = Asset..(10209590), Pitch = 1.1, Volume = 0.45}, | |
55 | PartHit = {Id = "rbxasset://sounds\\metal.ogg", Pitch = 1, Volume = 0.2}, | |
56 | } | |
57 | ||
58 | ContentProvider = game:GetService("ContentProvider") | |
59 | for _,v in pairs(Images) do ContentProvider:Preload(v) end | |
60 | ||
61 | V3 = Vector3.new | |
62 | C3 = Color3.new | |
63 | BN = BrickColor.new | |
64 | CN = CFrame.new | |
65 | CA = CFrame.Angles | |
66 | MR = math.rad | |
67 | MRA = math.random | |
68 | MP = math.pi | |
69 | MH = math.huge | |
70 | UD = UDim2.new | |
71 | ||
72 | function RC(Pos, Dir, Max, Ignore) | |
73 | return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999)), Ignore) | |
74 | end | |
75 | ||
76 | function RayC(Start, En, MaxDist, Ignore) | |
77 | return RC(Start, (En - Start), MaxDist, Ignore) | |
78 | end | |
79 | ||
80 | function ComputePos(pos1, pos2) | |
81 | return CN(pos1, V3(pos2.x, pos1.y, pos2.z)) | |
82 | end | |
83 | ||
84 | function DetectSurface(pos, part) | |
85 | local surface = nil | |
86 | local pospos = part.CFrame | |
87 | local pos2 = pospos:pointToObjectSpace(pos) | |
88 | local siz = part.Size | |
89 | local shaep = part.Shape | |
90 | if shaep == Enum.PartType.Ball or shaep == Enum.PartType.Cylinder then | |
91 | surface = {"Anything", CN(pospos.p, pos)*CN(0, 0, -(pospos.p - pos).magnitude+0.12)*CA(MR(-90), 0, 0)} | |
92 | else | |
93 | if pos2.Y > ((siz.Y/2)-0.01) then | |
94 | surface = {"Top", CA(0, 0, 0)} | |
95 | elseif pos2.Y < -((siz.Y/2)-0.01) then | |
96 | surface = {"Bottom", CA(-MP, 0, 0)} | |
97 | elseif pos2.X > ((siz.X/2)-0.01) then | |
98 | surface = {"Right", CA(0, 0, MR(-90))} | |
99 | elseif pos2.X < -((siz.X/2)-0.01) then | |
100 | surface = {"Left", CA(0, 0, MR(90))} | |
101 | elseif pos2.Z > ((siz.Z/2)-0.01) then | |
102 | surface = {"Back", CA(MR(90), 0, 0)} | |
103 | elseif pos2.Z < -((siz.Z/2)-0.01) then | |
104 | surface = {"Front", CA(MR(-90), 0, 0)} | |
105 | end | |
106 | end | |
107 | return surface | |
108 | end | |
109 | ||
110 | function Compute(pos1, pos2) | |
111 | local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z) | |
112 | return CN(pos1, pos3) | |
113 | end | |
114 | ||
115 | function waitChild(n, p) | |
116 | local c = p:findFirstChild(n) | |
117 | if c then return c end | |
118 | while true do | |
119 | c = p.ChildAdded:wait() | |
120 | if c.Name == n then return c end | |
121 | end | |
122 | end | |
123 | ||
124 | function Notime(func) | |
125 | coroutine.resume(coroutine.create(function() | |
126 | func() | |
127 | end)) | |
128 | end | |
129 | ||
130 | local C3 = Color3.new | |
131 | local UD = UDim2.new | |
132 | local V2 = Vector2.new | |
133 | ||
134 | Torso = waitChild("Torso", Char) | |
135 | Head = waitChild("Head", Char) | |
136 | Rarm = waitChild("Right Arm", Char) | |
137 | Larm = waitChild("Left Arm", Char) | |
138 | Rleg = waitChild("Right Leg", Char) | |
139 | Lleg = waitChild("Left Leg", Char) | |
140 | Neck = waitChild("Neck", Torso) | |
141 | Hum = waitChild("Humanoid", Char) | |
142 | ||
143 | RSH = waitChild("Right Shoulder", Torso) | |
144 | LSH = waitChild("Left Shoulder", Torso) | |
145 | RH = waitChild("Right Hip", Torso) | |
146 | LH = waitChild("Left Hip", Torso) | |
147 | ||
148 | RSH.Part0 = Torso | |
149 | LSH.Part0 = Torso | |
150 | RH.Part0 = Torso | |
151 | LH.Part0 = Torso | |
152 | ||
153 | local Classes = {"Frame", "ImageLabel", "ImageButton", "TextLabel", "TextButton", "TextBox"} | |
154 | function Make(Class, Par, Size, Pos, Color, Trans, Border, Borderc, Txt, TxtC, Img) | |
155 | local Mk = "Frame" | |
156 | for _,v in pairs(Classes) do | |
157 | if Class == v then | |
158 | Mk = v | |
159 | end | |
160 | end | |
161 | local g = Instance.new(Mk) | |
162 | g.Size = Size | |
163 | g.Position = Pos | |
164 | g.BackgroundColor3 = Color | |
165 | g.Transparency = Trans | |
166 | g.BorderSizePixel = Border | |
167 | g.BorderColor3 = Borderc | |
168 | if Mk == "TextButton" or Mk == "TextLabel" or Mk == "TextBox" then | |
169 | g.Text = Txt | |
170 | g.TextColor3 = TxtC | |
171 | elseif Mk == "ImageLabel" or Mk == "ImageButton" then | |
172 | g.Image = Img | |
173 | end | |
174 | g.Parent = Par | |
175 | return g | |
176 | end | |
177 | ||
178 | Gui = Me:findFirstChild("PlayerGui") | |
179 | if Gui then | |
180 | for _,v in pairs(Gui:children()) do if v.Name == "Weapon GUI" then v:remove() end end | |
181 | end | |
182 | ||
183 | Screen = Instance.new("ScreenGui") | |
184 | Screen.Name = "Weapon GUI" | |
185 | ||
186 | AmmoTable = {} | |
187 | AccuracyGuis = {} | |
188 | lul = { | |
189 | {unit = V2(0, -1), size = V2(2, 25), offset = V2(-1, -1-25)}, | |
190 | {unit = V2(1, 0), size = V2(25, 2), offset = V2(1, -1)}, | |
191 | {unit = V2(0, 1), size = V2(2, 25), offset = V2(-1, -1)}, | |
192 | {unit = V2(-1, 0), size = V2(25, 2), offset = V2(-1-25, -1)} | |
193 | } | |
194 | ||
195 | Main = Make("Frame", Screen, UD(0, 175, 0, 20), UD(1, -185-60, 1, -30), C3(0.25, 0.25, 0.3), 0.6, 0, C3()) | |
196 | ||
197 | for i = 1, Ammunition.MaxAmmo, 1 do | |
198 | local Fr = Make("Frame", Main, UD(0, 8, 0, 14), UD(1, -12*i, 0, -14-6), C3(0.25, 0.25, 0.3), 0.6, 0, C3()) | |
199 | table.insert(AmmoTable, Fr) | |
200 | end | |
201 | ||
202 | AmmoAtm = Make("TextLabel", Main, UD(0, 0, 0, 0), UD(0, 8, 0.5, 0), C3(), 0, 0, C3(), "0", C3(1, 1, 1)) | |
203 | AmmoAtm.BackgroundTransparency = 1 | |
204 | AmmoAtm.TextXAlignment = "Left" | |
205 | AmmoAtm.Font = "ArialBold" | |
206 | AmmoAtm.FontSize = "Size18" | |
207 | ||
208 | AmmoLeft = Make("TextLabel", Main, UD(0, 0, 0, 0), UD(1, -8, 0.5, 0), C3(), 0, 0, C3(), "40", C3(1, 1, 1)) | |
209 | AmmoLeft.BackgroundTransparency = 1 | |
210 | AmmoLeft.TextXAlignment = "Right" | |
211 | AmmoLeft.Font = "ArialBold" | |
212 | AmmoLeft.FontSize = "Size18" | |
213 | ||
214 | ReloadGui = Make("TextLabel", Main, UD(0, 0, 0, 0), UD(1, -12, 0, -40), C3(), 1, 0, C3(), "RELOAD", C3(1, 0.25, 0.1)) | |
215 | ReloadGui.TextXAlignment = "Right" | |
216 | ReloadGui.Font = "ArialBold" | |
217 | ReloadGui.FontSize = "Size24" | |
218 | ||
219 | for _, prop in pairs(lul) do | |
220 | local g = Make("Frame", Screen, UD(0, prop.size.x, 0, prop.size.y), UD(0.5, prop.offset.x, 0.5, prop.offset.y), C3(0.8, 0.8, 0.9), 1, 0, C3()) | |
221 | table.insert(AccuracyGuis, {Gui = g, props = prop}) | |
222 | end | |
223 | ||
224 | Screen.Parent = Gui | |
225 | ||
226 | local Offset = 0.1 | |
227 | local Thing = 1 | |
228 | local Speed1 = 0.1 | |
229 | local Speed2 = 0 | |
230 | local TempAcc = 0 | |
231 | local AccTimesMax = 17 | |
232 | local AccTime = 1.25 | |
233 | local AccTimes = AccTimesMax | |
234 | local AccOn = false | |
235 | function AddInaccuracy(Acc) | |
236 | TempAcc = Acc | |
237 | end | |
238 | Notime(function() | |
239 | while true do | |
240 | ReNew() | |
241 | AmmoAtm.Text = Ammunition.Ammo | |
242 | AmmoLeft.Text = Ammunition.Ammoleft | |
243 | for i,v in pairs(AmmoTable) do | |
244 | v.Transparency = 1 | |
245 | end | |
246 | for i = 1, Ammunition.Ammo do | |
247 | AmmoTable[i].Transparency = 0.6 | |
248 | end | |
249 | if Ammunition.Ammo <= Ammunition.MaxAmmo/4 then ReloadFlash = true else ReloadFlash = false end | |
250 | local Speed = Torso.Velocity.magnitude | |
251 | Offset = 0 | |
252 | if Speed > 1 then | |
253 | Speed1 = Speed | |
254 | Thing = Thing*1.2 | |
255 | else | |
256 | Speed2 = Speed | |
257 | local lol = 1.4 | |
258 | if AccOn then lol = AccTime end | |
259 | Thing = Thing/lol | |
260 | end | |
261 | if TempAcc ~= 0 then | |
262 | Speed1 = TempAcc | |
263 | Thing = TempAcc/2 | |
264 | AccOn = true | |
265 | if TempAcc ~= 0 then | |
266 | AccTimes = AccTimes - 1 | |
267 | if AccTimes < 1 then AccTimes = AccTimesMax Notime(function() wait(0.4) AccOn = false end) TempAcc = 0 end | |
268 | end | |
269 | end | |
270 | if Thing < 1 then Thing = 1 elseif Thing > 14 then Thing = 14 end | |
271 | Offset = Accuracy.Minimum + ((Speed1 - Speed1/Thing)/(Speed1 - Speed1/14))*Accuracy.Maximum | |
272 | Accuracy.Momentum = Offset | |
273 | wait() | |
274 | end | |
275 | end) | |
276 | ||
277 | Notime(function() | |
278 | while true do | |
279 | if ReloadFlash then | |
280 | if ReloadOn then | |
281 | ReloadOn = false | |
282 | ReloadGui.Transparency = 1 | |
283 | else | |
284 | ReloadOn = true | |
285 | ReloadGui.Transparency = 0 | |
286 | end | |
287 | else | |
288 | ReloadGui.Transparency = 1 | |
289 | end | |
290 | wait(0.4) | |
291 | end | |
292 | end) | |
293 | ||
294 | ||
295 | Add = { | |
296 | Head = function(P, Scale) | |
297 | local m = Instance.new("SpecialMesh") | |
298 | m.MeshType = "Head" | |
299 | m.Scale = Scale or V3(1, 1, 1) | |
300 | m.Parent = P | |
301 | return m | |
302 | end, | |
303 | Sphere = function(P, Scale) | |
304 | local m = Instance.new("SpecialMesh") | |
305 | m.MeshType = "Sphere" | |
306 | m.Scale = Scale or V3(1, 1, 1) | |
307 | m.Parent = P | |
308 | return m | |
309 | end, | |
310 | Wedge = function(P, Scale) | |
311 | local m = Instance.new("SpecialMesh") | |
312 | m.MeshType = "Wedge" | |
313 | m.Scale = Scale or V3(1, 1, 1) | |
314 | m.Parent = P | |
315 | return m | |
316 | end, | |
317 | Block = function(P, Scale, Bevel) | |
318 | local m = Instance.new("BlockMesh") | |
319 | - | m.Bevel = Bevel |
319 | + | |
320 | m.Parent = P | |
321 | return m | |
322 | end | |
323 | } | |
324 | ||
325 | for _,v in pairs(Sounds) do | |
326 | ContentProvider:Preload(v.Id) | |
327 | end | |
328 | ||
329 | function PlaySound(Sound, bool) | |
330 | Pitch = Sound.Pitch | |
331 | if bool then | |
332 | Pitch = MRA((Sound.Pitch*0.75)*1000, (Sound.Pitch*1.15)*1000)/1000 | |
333 | end | |
334 | local a = Instance.new("Sound") | |
335 | a.SoundId = Sound.Id | |
336 | a.Volume = Sound.Volume | |
337 | a.Pitch = Pitch | |
338 | a.Name = "FX" | |
339 | a.Parent = Torso | |
340 | a:play() | |
341 | Notime(function() | |
342 | wait(1) | |
343 | a:remove() | |
344 | end) | |
345 | end | |
346 | ||
347 | function GetParts(pos, dist) | |
348 | local parts = {} | |
349 | local function o(p) | |
350 | for _,v in pairs(p:children()) do | |
351 | if v:IsA("BasePart") then | |
352 | if (pos - v.Position).magnitude <= dist then | |
353 | table.insert(parts, {v, (pos - v.Position).magnitude, v.Anchored}) | |
354 | end | |
355 | end | |
356 | o(v) | |
357 | end | |
358 | end | |
359 | o(workspace) | |
360 | return parts | |
361 | end | |
362 | ||
363 | function GetHum(P) | |
364 | for _,v in pairs(P:children()) do | |
365 | if v:IsA("Humanoid") then | |
366 | if v.Health > 0 then | |
367 | return v | |
368 | end | |
369 | end | |
370 | end | |
371 | end | |
372 | ||
373 | function GetGroup(Pos, Distance, Hit) | |
374 | local tab = {} | |
375 | for _,v in pairs(workspace:children()) do | |
376 | local h = GetHum(v) | |
377 | local t = v:findFirstChild("Torso") | |
378 | if h and t and v ~= Hit.Parent then | |
379 | if (t.Position - Pos).magnitude <= Distance then | |
380 | table.insert(tab, {h, v, (t.Position - Pos).magnitude}) | |
381 | end | |
382 | end | |
383 | end | |
384 | if Hit then | |
385 | local h = GetHum(Hit.Parent) | |
386 | if h then | |
387 | table.insert(tab, {h, Hit.Parent, 0}) | |
388 | end | |
389 | end | |
390 | return tab | |
391 | end | |
392 | ||
393 | function Part(Par, Anc, Colli, Tran, Ref, Col, Siz) | |
394 | local p = Instance.new("Part") | |
395 | p.formFactor = "Custom" | |
396 | p.TopSurface = 0 | |
397 | p.BottomSurface = 0 | |
398 | p.Transparency = Tran | |
399 | p.Reflectance = Ref | |
400 | p.Anchored = Anc | |
401 | p.CanCollide = Colli | |
402 | p.BrickColor = Col | |
403 | p.Size = Siz | |
404 | p.Locked = true | |
405 | p.Parent = Par | |
406 | p:BreakJoints() | |
407 | return p | |
408 | end | |
409 | ||
410 | function Weld(P0, P1, C0, C1) | |
411 | local w = Instance.new("Weld") | |
412 | w.Part0 = P0 | |
413 | w.Part1 = P1 | |
414 | if C0 then | |
415 | w.C0 = C0 | |
416 | end | |
417 | if C1 then | |
418 | w.C1 = C1 | |
419 | end | |
420 | w.Parent = P0 | |
421 | return w | |
422 | end | |
423 | ||
424 | for _,v in pairs(Char:children()) do | |
425 | if v.Name == ModelName then | |
426 | v:remove() | |
427 | end | |
428 | end | |
429 | ||
430 | for _,v in pairs(Char:children()) do if v.Name == ModelName then v:remove() end end | |
431 | ||
432 | Model = Instance.new("Model") | |
433 | Model.Name = ModelName | |
434 | ||
435 | FTorso = Part(Model, false, false, 1, 0, Torso.BrickColor, V3(2, 2, 1)) | |
436 | FW = Weld(Torso, FTorso) | |
437 | ||
438 | RAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
439 | LAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
440 | RLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
441 | LLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
442 | ||
443 | RABW = Weld(Torso, RAB, CN(), CN(-1.5, -0.5, 0)) | |
444 | LABW = Weld(Torso, LAB, CN(), CN(1.5, -0.5, 0)) | |
445 | RLBW = Weld(Torso, RLB, CN(), CN(-0.5, 1, 0)) | |
446 | LLBW = Weld(Torso, LLB, CN(), CN(0.5, 1, 0)) | |
447 | ||
448 | RAW = Weld(RAB, nil, CN(), CN(0, 0.5, 0)) | |
449 | LAW = Weld(LAB, nil, CN(), CN(0, 0.5, 0)) | |
450 | RLW = Weld(RLB, nil, CN(), CN(0, 1, 0)) | |
451 | LLW = Weld(LLB, nil, CN(), CN(0, 1, 0)) | |
452 | ||
453 | TW = Weld(Torso, nil, CN(-0.4, -1.5, 0.7), CA(MR(55), MR(-90), MR(0))) | |
454 | ||
455 | local FH = Instance.new("Humanoid",Model) | |
456 | FH.PlatformStand = true | |
457 | FH.MaxHealth = math.huge | |
458 | FH.Health = math.huge | |
459 | ||
460 | pcall(function() Torso:findFirstChild("Shirt"):clone().Parent = Model end) | |
461 | ||
462 | local hh = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
463 | hh.Name = "Head" | |
464 | Weld(FTorso, hh) | |
465 | ||
466 | Weapon = Instance.new("Model") | |
467 | Weapon.Name = "Weapon" | |
468 | ||
469 | HB = Part(Weapon, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
470 | HBW = Weld(Rarm, HB, CN(0, -0.7, 0), CA(MR(-90), MR(180), 0)) | |
471 | HW = Weld(HB, nil, CA(MR(38), MR(-28), MR(-90)) * CN(0, -0.2, -3.8)) | |
472 | ||
473 | LHB = Part(Weapon, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
474 | LHBW = Weld(Larm, LHB, CN(0, -0.7, 0), CA(MR(-90), MR(180), 0)) | |
475 | LHW = Weld(LHB, nil, CA(MR(-2), MR(30), MR(-3)) * CN(-0.1, 0.32, -0.24)) | |
476 | LHWK = Weld(LHB, nil, CA(MR(170), 0, 0)) | |
477 | ||
478 | ||
479 | Handle = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.5, 0.9, 0.9)) | |
480 | TW.Part1 = Handle | |
481 | ||
482 | Handle2 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.5, 0.6, 1.6)) | |
483 | Weld(Handle, Handle2, CA(MR(-45), 0, 0), CN(0, 0.5, -0.4)) | |
484 | ||
485 | Handle3 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.5, 0.7, 1.3)) | |
486 | Weld(Handle2, Handle3, CA(MR(45), 0, 0), CN(0, -0.4, -0.9)) | |
487 | ||
488 | Pipe1 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.3, 0.3, 3.2)) | |
489 | Add.Block(Pipe1, V3(1,1,1), 0.08) | |
490 | Weld(Handle3, Pipe1, CN(0, 0.15, 1.6+0.55)) | |
491 | ||
492 | Pipe2 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.3, 0.3, 1.7)) | |
493 | Add.Block(Pipe2, V3(1,1,1), 0.08) | |
494 | Weld(Handle3, Pipe2, CN(0, -0.15, 0.85+0.55)) | |
495 | ||
496 | Pipe3 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.25, 0.25, 1.6)) | |
497 | Add.Block(Pipe3, V3(1,1,1), 0.065) | |
498 | Weld(Pipe2, Pipe3, CN(0, 0, 0.8+0.7)) | |
499 | ||
500 | Pump = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.45, 0.45, 1.1)) | |
501 | Add.Block(Pump, V3(1,1,1), 0.225/2) | |
502 | PumpWeld = Weld(Pipe2, Pump, CN(0, 0, 0.6), CN(0, 0, 0)) | |
503 | ||
504 | Pump2 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.5, 0.5, 0.3)) | |
505 | Add.Block(Pump, V3(1,1,1), 0.13) | |
506 | Weld(Pump, Pump2, CN(0, 0, -0.5)) | |
507 | ||
508 | for degrees = -20, 200, 20 do | |
509 | local Derp = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.2)) | |
510 | Add.Block(Derp, V3(0.4,0.6,0.4), 0.02) | |
511 | Weld(Handle3, Derp, CN(0, -0.45, -0.32) * CA(MR(degrees), 0, 0), CN(0, 0, -0.2)) | |
512 | end | |
513 | ||
514 | Derp = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.3)) | |
515 | Add.Block(Derp, V3(0.4,1,1), 0.02) | |
516 | Weld(Handle3, Derp, CN(0, 0, -0.32) * CA(MR(-20), 0, 0), CN(0, 0.45, -0.2)) | |
517 | ||
518 | Trigger = Part(Weapon, false, false, 0, 0, BN("Really black"), V3(0.2, 0.3, 0.2)) | |
519 | Add.Block(Trigger, V3(0.5, 0.9, 0.3), 0.02) | |
520 | TriggerWeld = Weld(Handle3, Trigger, CN(0, -0.45, -0.4) * CA(MR(2), 0, 0)) | |
521 | ||
522 | Aim = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.3, 0.2, 0.7)) | |
523 | Add.Block(Aim, V3(1,0.7,1), 0.05) | |
524 | Weld(Pipe1, Aim, CN(0, 0.12, 1.1)) | |
525 | ||
526 | Aim1 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.2)) | |
527 | Add.Block(Aim1, V3(0.3, 0.7, 0.5)) | |
528 | Weld(Aim, Aim1, CN(-.1, 0.1, -0.25)) | |
529 | ||
530 | Aim2 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.2)) | |
531 | Add.Block(Aim2, V3(0.3, 0.7, 0.5)) | |
532 | Weld(Aim, Aim2, CN(.1, 0.1, -0.25)) | |
533 | ||
534 | Aim3 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.2)) | |
535 | Add.Block(Aim3, V3(0.3, 0.7, 0.5)) | |
536 | Weld(Aim, Aim3, CN(0, 0.1, 0.25)) | |
537 | ||
538 | BulletFlip = Part(Weapon, false, false, 0, 0, BN("Light grey"), V3(0.2, 0.3, 0.6)) | |
539 | Flip = Weld(Handle3, BulletFlip, CN(-0.18, 0.1, 0.2) * CA(0, MR(-10), 0)) | |
540 | ||
541 | ||
542 | ||
543 | BeltWelds = {} | |
544 | ||
545 | BeltK = nil | |
546 | for i = -0.5, 0.5, 1 do | |
547 | local Belt = Part(Weapon, false, false, 0, 0, BN("Black"), V3(2.1, 0.3, 0.2)) | |
548 | table.insert(BeltWelds, Weld(Torso, Belt, CN(0, -0.9, i))) | |
549 | end | |
550 | for i = 1, -1, -2 do | |
551 | local Belt = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.3, 1.1)) | |
552 | table.insert(BeltWelds, Weld(Torso, Belt, CN(i, -0.9, 0))) | |
553 | BeltK = Belt | |
554 | end | |
555 | ||
556 | for i = -0.25, 0.25, 0.5 do | |
557 | local Pocket = Part(Weapon, false, false, 0, 0, BN("Black"), V3(1.1, 0.9, 0.2)) | |
558 | table.insert(BeltWelds, Weld(Torso, Pocket, CN(0.8, -1.2, -0.8) * CA(0, MR(-15), 0), CN(0, 0, i))) | |
559 | end | |
560 | ||
561 | for i = -0.5, 0.5, 1 do | |
562 | local Pocket = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.6, 0.9, 0.2)) | |
563 | table.insert(BeltWelds, Weld(Torso, Pocket, CN(0.8, -1.2, -0.8) * CA(0, MR(-15)+MP/2, 0), CN(0, 0, i))) | |
564 | end | |
565 | Pocket = Part(Weapon, false, false, 0, 0, BN("Black"), V3(1.1, 0.2, 0.6)) | |
566 | table.insert(BeltWelds, Weld(Torso, Pocket, CN(0.8, -1.6, -0.8) * CA(0, MR(-15), 0))) | |
567 | ||
568 | function Shell(P) | |
569 | local Shel = Instance.new("Model") | |
570 | local Back = Part(Shel, false, false, 0, 0, BN("Bright yellow"), V3(0.3, 0.3, 0.25)) | |
571 | local Main = Part(Shel, false, false, 0, 0, BN("Bright red"), V3(0.3, 0.3, 0.4)) | |
572 | Add.Block(Back, V3(1,1,1), 0.077) | |
573 | Add.Block(Main, V3(1,1,1), 0.077) | |
574 | Weld(Main, Back, CN(0, 0, -0.225)) | |
575 | Shel.Parent = P | |
576 | return {Model = Shel, Back = Back, Main = Main} | |
577 | end | |
578 | ||
579 | for y = 0.15, 0.65, 0.25 do | |
580 | for x = -0.12, 0.13, 0.24 do | |
581 | for z = -0.25, 0.26, 0.5 do | |
582 | local sh = Shell(Weapon) | |
583 | Weld(Pocket, sh.Main, CN(z-0.05, y, x), CA(0, MP/2, 0)) | |
584 | end | |
585 | end | |
586 | end | |
587 | ||
588 | KnifeSheath = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.3, 0.9, 0.6)) | |
589 | SheathWeld = Weld(BeltK, KnifeSheath, CN(-0.2, -0.3, -0.25) * CA(MR(-20), 0, 0)) | |
590 | ||
591 | KnifeHandle = Part(Weapon, false, false, 0, 0, BN("Really black"), V3(0.3, 0.6, 0.3)) | |
592 | KnifeWeld = Weld(KnifeSheath, KnifeHandle, CA(MP, 0, 0), CN(0, 0.9, 0)) | |
593 | ||
594 | KnifeHandle2 = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(0.3, 0.2, 0.4)) | |
595 | Weld(KnifeHandle, KnifeHandle2, CN(0, 0.35, 0)) | |
596 | ||
597 | KnifeBlade1 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.2, 0.8, 0.3)) | |
598 | Add.Block(KnifeBlade1, V3(0.4, 1, 1), 0.05) | |
599 | Weld(KnifeHandle2, KnifeBlade1, CN(0, 0.42, 0)) | |
600 | ||
601 | KnifeBlade2 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.2, 0.24, 0.24)) | |
602 | Add.Block(KnifeBlade2, V3(0.4, 1, 1), 0.05) | |
603 | Weld(KnifeBlade1, KnifeBlade2, CN(0, 0.32, 0), CA(MR(45), 0, 0)) | |
604 | ||
605 | function Show_Damage(P, D, Area) | |
606 | local mo = Instance.new("Model") | |
607 | mo.Name = D | |
608 | local p = Part(mo, true, false, 0, 0, BN("Bright red"), V3(0.2, 0.2, 0.2)) | |
609 | p.Name = "Head" | |
610 | local m = Instance.new("SpecialMesh") | |
611 | m.MeshType = "Brick" | |
612 | m.Scale = Vector3.new(3.5, 2.3, 3.5) | |
613 | m.Parent = p | |
614 | local h = Instance.new("Humanoid") | |
615 | h.Health = 0 | |
616 | h.MaxHealth = 0 | |
617 | h.Name = "asd" | |
618 | h.Parent = mo | |
619 | local nah = true | |
620 | mo.Parent = workspace | |
621 | local cf = CN(P) * CN(MRA(-Area*100, Area*100)/100, MRA(-Area*100, Area*100)/100, MRA(-Area*100, Area*100)/100) | |
622 | p.CFrame = cf | |
623 | Notime(function() | |
624 | Notime(function() | |
625 | for i = 0, 6, 0.03 do | |
626 | wait() | |
627 | p.CFrame = cf * CN(0, i, 0) | |
628 | end | |
629 | end) | |
630 | wait(1.5) | |
631 | for i = 0, 1, 0.05 do | |
632 | p.Transparency = i | |
633 | if nah then mo.Name = "" nah = false else mo.Name = "- "..D nah = true end | |
634 | wait() | |
635 | end | |
636 | mo:remove() | |
637 | end) | |
638 | end | |
639 | ||
640 | function Hit(part) | |
641 | local H = GetHum(part.Parent) | |
642 | if H and Debounce and Hurt then | |
643 | Debounce = false | |
644 | local Dmg = MRA(MeleeDmg/1.3, MeleeDmg) | |
645 | H.Health = H.Health - Dmg | |
646 | Show_Damage(KnifeBlade2.Position, Dmg, 0.1) | |
647 | end | |
648 | end | |
649 | ||
650 | KnifeBlade1.Touched:connect(Hit) | |
651 | KnifeBlade2.Touched:connect(Hit) | |
652 | ||
653 | Weapon.Parent = Model | |
654 | Model.Parent = Char | |
655 | ||
656 | if script.Parent.className ~= "HopperBin" then | |
657 | h = Instance.new("HopperBin", Me.Backpack) | |
658 | h.Name = ToolName | |
659 | script.Parent = h | |
660 | end | |
661 | ||
662 | bin = script.Parent | |
663 | ||
664 | function Attach(t) | |
665 | RSH.Part0 = t | |
666 | LSH.Part0 = t | |
667 | RH.Part0 = t | |
668 | LH.Part0 = t | |
669 | RABW.Part0 = t | |
670 | LABW.Part0 = t | |
671 | LLBW.Part0 = t | |
672 | RLBW.Part0 = t | |
673 | for _,v in pairs(BeltWelds) do | |
674 | v.Part0 = t | |
675 | end | |
676 | if t == Torso then | |
677 | FTorso.Transparency = 1 | |
678 | else | |
679 | Torso.Transparency = 1 | |
680 | end | |
681 | t.Transparency = 0 | |
682 | end | |
683 | ||
684 | function Normal() | |
685 | RAW.C0 = CA(MR(90), 0, MR(-65)) * CN(0.6, -0.9, 0) | |
686 | LAW.C0 = CA(MR(85), 0, MR(-40)) * CN(0.5, -0.5, 0) | |
687 | FW.C0 = CA(0, MR(-70), 0) | |
688 | HW.C0 = CA(MR(0), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
689 | LHW.C0 = CA(MR(-2), MR(30), MR(-3)) * CN(-0.1, 0.32, -0.24) | |
690 | PumpWeld.C1 = CN(0, 0, 0) | |
691 | Flip.C1 = CN(0, 0, 0) | |
692 | Attach(FTorso) | |
693 | LHW.Part1 = nil | |
694 | TW.Part1 = nil | |
695 | LHWK.Part1 = nil | |
696 | KnifeWeld.Part1 = KnifeHandle | |
697 | Neck.C0 = necko | |
698 | HW.Part1 = Handle | |
699 | end | |
700 | ||
701 | function Swing() | |
702 | Swinging = true | |
703 | for i = 0.5, 1, 0.5 do | |
704 | LAW.C0 = CA(MR(85-8*i), 0, MR(-40+5*i)) * CN(0.5, -0.5+0.2*i, 0) | |
705 | RAW.C0 = CA(MR(90-5*i), 0, MR(-65-5*i)) * CN(0.6+0.05*i, -0.9+0.05*i, -0.1*i) | |
706 | HW.C0 = CA(MR(-5*i), MR(5+5*i), MR(0)) * CN(0.4, 0, -1.2) | |
707 | FW.C0 = CA(0, MR(-70+8*i), 0) | |
708 | wait() | |
709 | end | |
710 | for i = 0.33, 1, 0.33 do | |
711 | LAW.C0 = CA(MR(77-37*i), 0, MR(-35+30*i)) * CN(0.5-0.15*i, -0.3+0.3*i, 0) | |
712 | RAW.C0 = CA(MR(85-15*i), 0, MR(-70-5*i)) * CN(0.65+0.15*i, -0.85+0.2*i, -0.1-0.2*i) | |
713 | HW.C0 = CA(MR(-5-15*i), MR(10+10*i), MR(0)) * CN(0.4, 0, -1.2) | |
714 | FW.C0 = CA(0, MR(-62+58*i), 0) | |
715 | wait() | |
716 | end | |
717 | LHWK.Part1 = KnifeHandle | |
718 | KnifeWeld.Part1 = nil | |
719 | PlaySound(Sounds.Slash) | |
720 | for i = 0.25, 1, 0.25 do | |
721 | LAW.C0 = CA(MR(40+30*i), 0, MR(-5-45*i)) * CN(0.35-0.2*i, -0.5*i, 0) | |
722 | RAW.C0 = CA(MR(70-15*i), 0, MR(-75-5*i)) * CN(0.8, -0.65+0.15*i, -0.3-0.05*i) | |
723 | HW.C0 = CA(MR(-20-10*i), MR(20+5*i), MR(0)) * CN(0.4, 0, -1.2) | |
724 | FW.C0 = CA(0, MR(-4+14*i), 0) | |
725 | LHWK.C0 = CN(0, -0.1*i, 0.2*i) * CA(MR(170), 0, MR(-50*i)) | |
726 | wait() | |
727 | end | |
728 | Hurt = true | |
729 | Debounce = true | |
730 | for i = 0.25, 1, 0.25 do | |
731 | LAW.C0 = CA(MR(70+20*i), 0, MR(-50+35*i)) * CN(0.15-0.05*i, -0.5-0.3*i, 0) | |
732 | FW.C0 = CA(0, MR(10-60*i), 0) | |
733 | LHWK.C0 = CN(0, -0.1-0.05*i, 0.2+0.1*i) * CA(MR(170), 0, MR(-50-40*i)) | |
734 | wait() | |
735 | end | |
736 | for i = 0.25, 1, 0.25 do | |
737 | LAW.C0 = CA(MR(90+10*i), 0, MR(-15+15*i)) * CN(0.1, -0.9, 0) | |
738 | FW.C0 = CA(0, MR(-50-40*i), 0) | |
739 | LHWK.C0 = CN(0, -0.15, 0.3) * CA(MR(170), 0, MR(-90)) | |
740 | wait() | |
741 | end | |
742 | for i = 0.33, 1, 0.33 do | |
743 | LAW.C0 = CA(MR(100+3*i), 0, 0) * CN(0.1, -0.9, 0) | |
744 | FW.C0 = CA(0, MR(-90-6*i), 0) | |
745 | LHWK.C0 = CN(0, -0.15, 0.3) * CA(MR(170), 0, MR(-90)) | |
746 | wait() | |
747 | end | |
748 | Hurt = false | |
749 | wait(0.04) | |
750 | for i = 0.25, 1, 0.25 do | |
751 | LAW.C0 = CA(MR(103-13*i), 0, 0) * CN(0.1, -0.9+0.1*i, 0) | |
752 | FW.C0 = CA(0, MR(-96+16*i), 0) | |
753 | LHWK.C0 = CN(0, -0.15, 0.3-0.1*i) * CA(MR(170), 0, MR(-90+15*i)) | |
754 | wait() | |
755 | end | |
756 | for i = 0.25, 1, 0.25 do | |
757 | LAW.C0 = CA(MR(90-42*i), 0, 0) * CN(0.1+0.1*i, -0.8+0.3*i, 0) | |
758 | RAW.C0 = CA(MR(55+15*i), 0, MR(-80+5*i)) * CN(0.8-0.05*i, -0.5-0.1*i, -0.35+0.05*i) | |
759 | FW.C0 = CA(0, MR(-80+10*i), 0) | |
760 | HW.C0 = CA(MR(-30+20*i), MR(25-15*i), MR(0)) * CN(0.4, 0, -1.2) | |
761 | LHWK.C0 = CN(0, -0.15, 0.2-0.45*i) * CA(MR(170), 0, MR(-75+75*i)) | |
762 | wait() | |
763 | end | |
764 | for i = 0.5, 1, 0.5 do | |
765 | LAW.C0 = CA(MR(48-8*i), 0, 0) * CN(0.2+0.05*i, -0.5, 0) | |
766 | RAW.C0 = CA(MR(70+10*i), 0, MR(-75+7*i)) * CN(0.75-0.05*i, -0.6-0.1*i, -0.3+0.05*i) | |
767 | FW.C0 = CA(0, MR(-70), 0) | |
768 | HW.C0 = CA(MR(-10+10*i), MR(10-5*i), MR(0)) * CN(0.4, 0, -1.2) | |
769 | LHWK.C0 = CN(0, -0.15, -0.25-0.15*i) * CA(MR(170), 0, 0) | |
770 | wait() | |
771 | end | |
772 | LHWK.Part1 = nil | |
773 | KnifeWeld.Part1 = KnifeHandle | |
774 | for i = 0.25, 1, 0.25 do | |
775 | LAW.C0 = CA(MR(40+40*i), 0, MR(-30*i)) * CN(0.25+0.2*i, -0.5, 0) | |
776 | RAW.C0 = CA(MR(80+10*i), 0, MR(-68+3*i)) * CN(0.7-0.1*i, -0.7-0.2*i, -0.25+0.2*i) | |
777 | wait() | |
778 | end | |
779 | for i = 0.5, 1, 0.5 do | |
780 | LAW.C0 = CA(MR(80+5*i), 0, MR(-30-10*i)) * CN(0.45+0.05*i, -0.5, -0.05+0.05*i) | |
781 | RAW.C0 = CA(MR(90), 0, MR(-65)) * CN(0.6, -0.9, 0) | |
782 | wait() | |
783 | end | |
784 | Normal() | |
785 | Swinging = false | |
786 | end | |
787 | ||
788 | function Reload(once) | |
789 | while Ammunition.Ammo < Ammunition.MaxAmmo and Ammunition.Ammoleft > 0 do | |
790 | wait() | |
791 | for i = 0.33, 1, 0.33 do | |
792 | RAW.C0 = CA(MR(45-2*i), 0, MR(-15)) * CN(0, -0.15-0.05*i, 0) | |
793 | LAW.C0 = CA(MR(50), MR(40), MR(-15)) * CN(0.5, -0.5, 0) | |
794 | LHW.C0 = CA(MR(-35), MR(60), MR(-45)) * CN(-0.6, 0.2, -0.24) | |
795 | wait() | |
796 | end | |
797 | for i = 0.25, 1, 0.25 do | |
798 | RAW.C0 = CA(MR(43-8*i), 0, MR(-15)) * CN(0, -0.2-0.2*i, 0) | |
799 | LAW.C0 = CA(MR(50), MR(40), MR(-15)) * CN(0.5, -0.5, 0) | |
800 | LHW.C0 = CA(MR(-35), MR(60), MR(-45)) * CN(-0.6, 0.2, -0.24) | |
801 | wait() | |
802 | end | |
803 | for i = 0.5, 1, 0.5 do | |
804 | RAW.C0 = CA(MR(35-2*i), 0, MR(-15)) * CN(0, -0.4-0.05*i, 0) | |
805 | wait() | |
806 | end | |
807 | local shel = Shell(Weapon) | |
808 | local w = Weld(Rarm, shel.Main, CN(0, -1.25, 0.45), CA(MR(-140), 0, MR(60))) | |
809 | for i = 0.25, 1, 0.25 do | |
810 | RAW.C0 = CA(MR(33+20*i), 0, MR(-15-10*i)) * CN(0, -0.45+0.2*i, 0) | |
811 | LAW.C0 = CA(MR(50-5*i), MR(40), MR(-15+5*i)) * CN(0.5, -0.5, 0) | |
812 | w.C0 = CN(-0.1*i, -1.25, 0.45-0.25*i) | |
813 | wait() | |
814 | end | |
815 | for i = 0.2, 1, 0.2 do | |
816 | RAW.C0 = CA(MR(53+32*i), 0, MR(-25-12*i)) * CN(0, -0.25-0.3*i, 0) | |
817 | LAW.C0 = CA(MR(45), MR(40), MR(-10+10*i)) * CN(0.5, -0.5+0.15*i, 0) | |
818 | w.C0 = CN(-0.1-0.1*i, -1.25, 0.2-0.3*i) | |
819 | w.C1 = CA(MR(-140+50*i), 0, MR(60)) | |
820 | wait() | |
821 | end | |
822 | PlaySound(Sounds.Reload, false) | |
823 | for i = 0.25, 1, 0.25 do | |
824 | RAW.C0 = CA(MR(85+10*i), 0, MR(-42-8*i)) * CN(0, -0.55-0.1*i, 0) | |
825 | LAW.C0 = CA(MR(45), MR(40), 0) * CN(0.5, -0.35, 0) | |
826 | w.C0 = CN(-0.2-0.05*i, -1.25, -0.1-0.1*i) | |
827 | wait() | |
828 | end | |
829 | shel.Model:remove() shell = nil | |
830 | Ammunition.Ammo = Ammunition.Ammo + 1 | |
831 | Ammunition.Ammoleft = Ammunition.Ammoleft - 1 | |
832 | wait(0.1) | |
833 | for i = 0.33, 1, 0.33 do | |
834 | RAW.C0 = CA(MR(95-10*i), 0, MR(-50+10*i)) * CN(0, -0.65+0.1*i, 0) | |
835 | LAW.C0 = CA(MR(45+5*i), MR(40), MR(-12*i)) * CN(0.5, -0.35-0.1*i, 0) | |
836 | wait() | |
837 | end | |
838 | for i = 0.25, 1, 0.25 do | |
839 | RAW.C0 = CA(MR(85-40*i), 0, MR(-40+25*i)) * CN(0, -0.55+0.4*i, 0) | |
840 | LAW.C0 = CA(MR(50), MR(40), MR(-12-3*i)) * CN(0.5, -0.45-0.05*i, 0) | |
841 | wait() | |
842 | end | |
843 | if once then break end | |
844 | if not ReloadHold then break end | |
845 | end | |
846 | for i = 0.33, 1, 0.33 do | |
847 | RAW.C0 = CA(MR(45+10*i), 0, MR(-15-10*i)) * CN(0.1*i, -0.15-0.1*i, 0) | |
848 | LAW.C0 = CA(MR(52+12*i), MR(40-5*i), MR(-15-5*i)) * CN(0.5, -0.5, 0) | |
849 | LHW.C0 = CA(MR(-35+10*i), MR(60-10*i), MR(-45+10*i)) * CN(-0.6+0.1*i, 0.2, -0.24) | |
850 | wait() | |
851 | end | |
852 | for i = 0.2, 1, 0.2 do | |
853 | RAW.C0 = CA(MR(55+30*i), 0, MR(-25-30*i)) * CN(0.1+0.4*i, -0.25-0.55*i, 0) | |
854 | LAW.C0 = CA(MR(70+10*i), MR(35-30*i), MR(-20-15*i)) * CN(0.5, -0.5, 0) | |
855 | LHW.C0 = CA(MR(-25+18*i), MR(50-15*i), MR(-35+25*i)) * CN(-0.5+0.3*i, 0.2+0.1*i, -0.24) | |
856 | wait() | |
857 | end | |
858 | for i = 0.25, 1, 0.25 do | |
859 | RAW.C0 = CA(MR(85+5*i), 0, MR(-55-10*i)) * CN(0.5+0.1*i, -0.8-0.1*i, 0) | |
860 | LAW.C0 = CA(MR(80+5*i), MR(5-5*i), MR(-35-5*i)) * CN(0.5, -0.5, 0) | |
861 | LHW.C0 = CA(MR(-7+5*i), MR(35-5*i), MR(-10+7*i)) * CN(-0.2+0.1*i, 0.3+0.02*i, -0.24) | |
862 | wait() | |
863 | end | |
864 | end | |
865 | ||
866 | function ReloadStart(once) | |
867 | Reloading = true | |
868 | HW.Part1 = nil | |
869 | LHW.Part1 = Pipe2 | |
870 | for i = 0.25, 1, 0.25 do | |
871 | RAW.C0 = CA(MR(90-10*i), 0, MR(-65+10*i)) * CN(0.6-0.2*i, -0.9+0.15*i, 0) | |
872 | LAW.C0 = CA(MR(85-5*i), MR(7*i), MR(-40+5*i)) * CN(0.5, -0.5, 0) | |
873 | LHW.C0 = CA(MR(-2-8*i), MR(30+5*i), MR(-3-12*i)) * CN(-0.1-0.1*i, 0.32-0.12*i, -0.24) | |
874 | wait() | |
875 | end | |
876 | for i = 0.15, 1, 0.15 do | |
877 | RAW.C0 = CA(MR(80-35*i), 0, MR(-55+40*i)) * CN(0.4-0.4*i, -0.75+0.6*i, 0) | |
878 | LAW.C0 = CA(MR(80-30*i), MR(7+33*i), MR(-35+20*i)) * CN(0.5, -0.5, 0) | |
879 | LHW.C0 = CA(MR(-10-25*i), MR(35+25*i), MR(-15-30*i)) * CN(-0.2-0.4*i, 0.2, -0.24) | |
880 | wait() | |
881 | end | |
882 | Reload(once) | |
883 | Normal() | |
884 | Reloading = false | |
885 | end | |
886 | ||
887 | function AimEet() | |
888 | end | |
889 | ||
890 | function Shoot(Start, To) | |
891 | local Accu = CA(MR(MRA(-Accuracy.Momentum*1000, Accuracy.Momentum*1000)/1700), MR(MRA(-Accuracy.Momentum*1000, Accuracy.Momentum*1000)/1000), MR(MRA(-Accuracy.Momentum*1000, Accuracy.Momentum*1000)/1000)) | |
892 | for Pellets = 1, 8 do | |
893 | local Power = 20 | |
894 | local Drop = 0.2 | |
895 | local Face = CN(Start, To) * Accu * CA(MR(MRA(-10000, 10000)/2500), MR(MRA(-10000, 10000)/2500), MR(MRA(-10000, 10000)/2500)) | |
896 | local Pellet = Part(PelletModel, true, false, 0, 0, BN("Dark grey"), V3(0.2, 0.2, 0.3)) | |
897 | Pellet.CFrame = Face | |
898 | local LastPoint = Face.p | |
899 | Notime(function() | |
900 | local HitObj | |
901 | local HitPos | |
902 | local DistThing = 250 | |
903 | for Distance = Power, 600, Power do | |
904 | Face = Face * CA(MR(-Drop), 0, 0) * CN(0, 0, -Power) | |
905 | local PointNow = Face.p | |
906 | local Hit, Pos = RayC(LastPoint, PointNow, Power+2, EffectModel) | |
907 | if Hit then | |
908 | DistThing = Distance | |
909 | if DistThing > 250 then DistThing = 200 end | |
910 | PointNow = Pos | |
911 | HitPos = Pos | |
912 | HitObj = Hit | |
913 | end | |
914 | local Dist = (PointNow - LastPoint).magnitude | |
915 | Pellet.CFrame = Face | |
916 | Drop = Drop + 0.04 | |
917 | local Effect = Part(EffectModel, true, false, 0, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
918 | Effect.CFrame = CN(LastPoint, PointNow) * CA(MR(-90), 0, 0) * CN(0, Dist/2, 0) | |
919 | local H = Add.Head(Effect, V3(0.8, Dist*5, 0.8)) | |
920 | LastPoint = Face.p | |
921 | Power = Power - Drop/3 | |
922 | Notime(function() | |
923 | for i = 0, 1, 0.2 do | |
924 | wait() | |
925 | Effect.Transparency = i | |
926 | end | |
927 | Effect:remove() | |
928 | end) | |
929 | if Hit then | |
930 | Pellet.CFrame = CN(Pos) | |
931 | break | |
932 | end | |
933 | wait() | |
934 | end | |
935 | Pellet:remove() | |
936 | if HitObj then | |
937 | local Surface = DetectSurface(HitPos, HitObj) | |
938 | local C = CN(HitPos) * CA(HitObj.CFrame:toEulerAnglesXYZ()) * Surface[2] | |
939 | if Surface[1] == "Anything" then | |
940 | C = Surface[2] | |
941 | end | |
942 | local H = nil | |
943 | if HitObj.Parent ~= workspace then | |
944 | H = GetHum(HitObj.Parent) | |
945 | if HitObj.Parent.Parent ~= workspace and H == nil then | |
946 | H = GetHum(HitObj.Parent.Parent) | |
947 | end | |
948 | end | |
949 | if H then | |
950 | local Dmg = DistThing/200 | |
951 | Dmg = (1-Dmg)*15 | |
952 | Dmg = MRA(Dmg*850, Dmg*1100)/1000 | |
953 | H.Health = H.Health - Dmg | |
954 | PlaySound(Sounds.Hit) | |
955 | Show_Damage(HitObj.Position, math.floor(Dmg), 1.5) | |
956 | else | |
957 | PlaySound(Sounds.PartHit) | |
958 | local BulletHole = Part(EffectModel, true, false, 1, 0, BN("White"), V3(0.8, 0.2, 0.8)) | |
959 | BulletHole.CFrame = C * CN(0, -0.085, 0) | |
960 | local Dec = Instance.new("Decal",BulletHole) | |
961 | Dec.Texture = Images[MRA(1,#Images)] | |
962 | Dec.Face = "Top" | |
963 | if not HitObj.Anchored then | |
964 | BulletHole.Anchored = false | |
965 | local W = Weld(HitObj, BulletHole, HitObj.CFrame:toObjectSpace(C)) | |
966 | end | |
967 | Notime(function() | |
968 | wait(MRA(700, 15000)/100) | |
969 | BulletHole:remove() | |
970 | end) | |
971 | end | |
972 | end | |
973 | end) | |
974 | end | |
975 | end | |
976 | ||
977 | function ShootAnim(From, To) | |
978 | Shoot(From, To) | |
979 | AddInaccuracy(16) | |
980 | PlaySound(Sounds.Fire, false) | |
981 | for i = 0.33, 1, 0.33 do | |
982 | RAW.C0 = CA(MR(90+10*i), 0, MR(-65)) * CN(0.6, -0.9+0.5*i, 0) | |
983 | LAW.C0 = CA(MR(85+26*i), 0, MR(-40)) * CN(0.5, -0.5+0.1*i, 0) | |
984 | HW.C0 = CA(MR(-15*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
985 | wait() | |
986 | end | |
987 | for i = 0.2, 1, 0.2 do | |
988 | RAW.C0 = CA(MR(100+5*i), 0, MR(-65)) * CN(0.6, -0.4+0.15*i, 0) | |
989 | LAW.C0 = CA(MR(111+4*i), 0, MR(-40)) * CN(0.5, -0.4+0.05*i, 0) | |
990 | HW.C0 = CA(MR(-15-2*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
991 | wait() | |
992 | end | |
993 | for i = 0.5, 1, 0.5 do | |
994 | RAW.C0 = CA(MR(105+2*i), 0, MR(-65)) * CN(0.6, -0.25+0.03*i, 0) | |
995 | LAW.C0 = CA(MR(115+2*i), 0, MR(-40)) * CN(0.5, -0.35+0.02*i, 0) | |
996 | HW.C0 = CA(MR(-17), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
997 | wait() | |
998 | end | |
999 | for i = 0.2, 1, 0.2 do | |
1000 | RAW.C0 = CA(MR(107-12*i), 0, MR(-65)) * CN(0.6, -0.22-0.68*i, 0) | |
1001 | LAW.C0 = CA(MR(117-17*i), 0, MR(-40)) * CN(0.5, -0.33-0.02*i, 0) | |
1002 | HW.C0 = CA(MR(-17+2*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
1003 | wait() | |
1004 | end | |
1005 | for i = 0.33, 1, 0.33 do | |
1006 | RAW.C0 = CA(MR(95-5*i), 0, MR(-65)) * CN(0.6, -0.9-0.1*i, 0) | |
1007 | LAW.C0 = CA(MR(100-5*i), 0, MR(-40)) * CN(0.5+0.1*i, -0.35+0.1*i, 0) | |
1008 | HW.C0 = CA(MR(-15+11*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
1009 | PumpWeld.C1 = CN(0, 0, 0.1*i) | |
1010 | wait() | |
1011 | end | |
1012 | for i = 0.33, 1, 0.33 do | |
1013 | RAW.C0 = CA(MR(90-3*i), 0, MR(-65)) * CN(0.6, -1+0.05*i, 0) | |
1014 | LAW.C0 = CA(MR(95-5*i), 0, MR(-40)) * CN(0.6+0.2*i, -0.25+0.35*i, 0) | |
1015 | HW.C0 = CA(MR(-4+4*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
1016 | PumpWeld.C1 = CN(0, 0, 0.1+0.6*i) | |
1017 | Flip.C1 = CN(0, 0, 0.5*i) | |
1018 | wait() | |
1019 | end | |
1020 | local sh = Shell(workspace) | |
1021 | sh.Main.CanCollide = true | |
1022 | sh.Back.CanCollide = true | |
1023 | sh.Main.CFrame = Handle3.CFrame * CN(0.3, 0.2, 0) | |
1024 | sh.Main.Velocity = (Handle3.CFrame * CA(0, MR(90), 0)).lookVector * 15 | |
1025 | Notime(function() | |
1026 | wait(MRA(100,180)/10) | |
1027 | for i = 0, 1, 0.005 do | |
1028 | sh.Main.Transparency = i | |
1029 | sh.Back.Transparency = i | |
1030 | wait() | |
1031 | end | |
1032 | sh.Model:remove() | |
1033 | end) | |
1034 | for i = 0.33, 1, 0.33 do | |
1035 | RAW.C0 = CA(MR(87+3*i), 0, MR(-65)) * CN(0.6, -0.95+0.05*i, 0) | |
1036 | LAW.C0 = CA(MR(90-5*i), 0, MR(-40)) * CN(0.8-0.3*i, 0.1-0.6*i, 0) | |
1037 | HW.C0 = CA(0, MR(5), 0) * CN(0.4, 0, -1.2) | |
1038 | PumpWeld.C1 = CN(0, 0, 0.7-0.7*i) | |
1039 | Flip.C1 = CN(0, 0, 0.5-0.5*i) | |
1040 | wait() | |
1041 | end | |
1042 | Normal() | |
1043 | end | |
1044 | ||
1045 | function ShootFunc(From, To) | |
1046 | local H, Pos = RayC(From, To, 10, EffectModel) | |
1047 | local Can = true | |
1048 | if H then | |
1049 | if H:IsDescendantOf(Char) then | |
1050 | Can = false | |
1051 | end | |
1052 | end | |
1053 | if Can then | |
1054 | Attacking = true | |
1055 | Ammunition.Ammo = Ammunition.Ammo - 1 | |
1056 | if Ammunition.Ammo < 0 then Ammunition.Ammo = 0 end | |
1057 | ShootAnim(From, To) | |
1058 | Attacking = false | |
1059 | end | |
1060 | end | |
1061 | ||
1062 | function SelectAnim() | |
1063 | RAW.Part1 = Rarm | |
1064 | for i = 0.25, 1, 0.25 do | |
1065 | RAW.C0 = CA(MR(-10*i), 0, MR(2*i)) | |
1066 | wait() | |
1067 | end | |
1068 | for i = 0.1, 1, 0.1 do | |
1069 | RAW.C0 = CN(-0.15*i, 0, -0.45*i) * CA(MR(-10-115*i), 0, MR(2+8*i)) * CN(0, -0.4*i, 0) | |
1070 | wait() | |
1071 | end | |
1072 | for i = 0.25, 1, 0.25 do | |
1073 | RAW.C0 = CN(-0.15, 0, -0.45-0.05*i) * CA(MR(-125-15*i), 0, MR(10)) * CN(0, -0.4, 0) | |
1074 | wait() | |
1075 | end | |
1076 | TW.Part1 = nil | |
1077 | HW.Part1 = Handle | |
1078 | for i = 0.25, 1, 0.25 do | |
1079 | RAW.C0 = CN(-0.15+0.15*i, 0, -0.5+0.1*i) * CA(MR(-140+10*i), 0, MR(10+2*i)) * CN(0, -0.4+0.15*i, 0) | |
1080 | HW.C0 = CA(MR(38+12*i), MR(-28-15*i), MR(-90-10*i)) * CN(0, -0.1*i, -3.8) | |
1081 | wait() | |
1082 | end | |
1083 | Attach(FTorso) | |
1084 | for i = 0.1, 1, 0.1 do | |
1085 | RAW.C0 = CN(0, 0, -0.4+0.3*i) * CA(MR(-130+90*i), 0, MR(12+30*i)) * CN(0, -0.25+0.25*i, 0) | |
1086 | HW.C0 = CA(MR(50+30*i), MR(-43-50*i), MR(-100-50*i)) * CN(0, -0.1-0.7*i, -3.8+0.7*i) | |
1087 | FW.C0 = CA(0, MR(-15*i), 0) | |
1088 | wait() | |
1089 | end | |
1090 | LAW.Part1 = Larm | |
1091 | for i = 0.15, 1, 0.15 do | |
1092 | RAW.C0 = CN(0, 0, -0.1+0.1*i) * CA(MR(-40+60*i), 0, MR(42+4*i)) | |
1093 | LAW.C0 = CA(MR(10*i), 0, MR(-8*i)) * CN(0, -0.15*i, 0) | |
1094 | FW.C0 = CA(0, MR(-15-20*i), 0) | |
1095 | HW.C0 = CA(MR(80+50*i), MR(-93-57*i), MR(-150-30*i)) * CN(0, -0.8, -3.1+1*i) | |
1096 | wait() | |
1097 | end | |
1098 | for i = 0.15, 1, 0.15 do | |
1099 | RAW.C0 = CA(MR(20+58*i), 0, MR(46-60*i)) * CN(0.2*i, -0.35*i, 0) | |
1100 | LAW.C0 = CA(MR(10+65*i), 0, MR(-8-32*i)) * CN(0.3*i, -0.15-0.25*i, 0) | |
1101 | FW.C0 = CA(0, MR(-35-30*i), 0) | |
1102 | HW.C0 = CA(MR(130+50*i), MR(-150-20*i), MR(-180)) * CN(0.25*i, -0.8+0.3*i, -2.1+0.9*i) | |
1103 | wait() | |
1104 | end | |
1105 | for i = 0.2, 1, 0.2 do | |
1106 | RAW.C0 = CA(MR(78+8*i), 0, MR(-14-41*i)) * CN(0.2+0.35*i, -0.35-0.55*i, 0) | |
1107 | LAW.C0 = CA(MR(75+7*i), 0, MR(-40)) * CN(0.3+0.15*i, -0.4-0.06*i, 0) | |
1108 | FW.C0 = CA(0, MR(-65-5*i), 0) | |
1109 | HW.C0 = CA(MR(0), MR(-10+10*i), MR(0)) * CN(0.25+0.1*i, -0.5+0.4*i, -1.2) | |
1110 | wait() | |
1111 | end | |
1112 | for i = 0.25, 1, 0.25 do | |
1113 | RAW.C0 = CA(MR(86+4*i), 0, MR(-55-10*i)) * CN(0.55+0.05*i, -0.8-0.1*i, 0) | |
1114 | LAW.C0 = CA(MR(82+3*i), 0, MR(-40)) * CN(0.45+0.05*i, -0.46-0.04*i, 0) | |
1115 | FW.C0 = CA(0, MR(-70), 0) | |
1116 | HW.C0 = CA(MR(0), MR(5*i), MR(0)) * CN(0.35+0.05*i, -0.1+0.1*i, -1.2) | |
1117 | wait() | |
1118 | end | |
1119 | end | |
1120 | ||
1121 | function DeselAnim() | |
1122 | for i = 0.25, 1, 0.25 do | |
1123 | RAW.C0 = CA(MR(90-10*i), 0, MR(-65+10*i)) * CN(0.6-0.05*i, -0.9+0.35*i, 0) | |
1124 | LAW.C0 = CA(MR(85-10*i), 0, MR(-40+4*i)) * CN(0.5-0.05*i, -0.5+0.04*i, 0) | |
1125 | FW.C0 = CA(0, MR(-70+10*i), 0) | |
1126 | HW.C0 = CA(MR(180-10*i), MR(-185+10*i), MR(180-10*i)) * CN(0.4-0.05*i, -0.1*i, -1.2) | |
1127 | wait() | |
1128 | end | |
1129 | for i = 0.07, 1, 0.07 do | |
1130 | RAW.C0 = CA(MR(80-80*i), 0, MR(-55+90*i)) * CN(0.55-0.35*i, -0.55+0.55*i, 0) | |
1131 | LAW.C0 = CA(MR(75-70*i), 0, MR(-36+30*i)) * CN(0.45-0.35*i, -0.46+0.36*i, 0) | |
1132 | FW.C0 = CA(0, MR(-60+40*i), 0) | |
1133 | HW.C0 = CA(MR(170-70*i), MR(-175+70*i), MR(170-70*i)) * CN(0.35-0.35*i, -0.1-0.1*i, -1.2-1*i) | |
1134 | wait() | |
1135 | end | |
1136 | for i = 0.25, 1, 0.25 do | |
1137 | RAW.C0 = CN(-0.1*i, 0, -0.15*i) * CA(MR(-30*i), 0, MR(35+10*i)) * CN(0.2-0.2*i, 0, 0) | |
1138 | LAW.C0 = CA(MR(5-5*i), 0, MR(-6+6*i)) * CN(0.1-0.1*i, -0.1+0.1*i, 0) | |
1139 | FW.C0 = CA(0, MR(-20+15*i), 0) | |
1140 | HW.C0 = CA(MR(100-20*i), MR(-105+15*i), MR(100-15*i)) * CN(0, -0.2, -2.2-0.3*i) | |
1141 | wait() | |
1142 | end | |
1143 | LAW.Part1 = nil | |
1144 | for i = 0.12, 1, 0.12 do | |
1145 | RAW.C0 = CN(-0.1-0.05*i, 0, -0.15-0.3*i) * CA(MR(-30-100*i), 0, MR(45-30*i)) * CN(0, -0.3*i, 0) | |
1146 | FW.C0 = CA(0, MR(-5+5*i), 0) | |
1147 | HW.C0 = CA(MR(80-37*i), MR(-90+55*i), MR(85-135*i)) * CN(0, -0.2, -2.5-0.9*i) | |
1148 | wait() | |
1149 | end | |
1150 | Attach(Torso) | |
1151 | for i = 0.2, 1, 0.2 do | |
1152 | RAW.C0 = CN(-0.15*i, 0, -0.45-0.05*i) * CA(MR(-130-10*i), 0, MR(15-5*i)) * CN(0, -0.3-0.1*i, 0) | |
1153 | HW.C0 = CA(MR(43-5*i), MR(-35+7*i), MR(-50-40*i)) * CN(0, -0.2, -3.4-0.4*i) | |
1154 | wait() | |
1155 | end | |
1156 | TW.Part1 = Handle | |
1157 | HW.Part1 = nil | |
1158 | for i = 0.25, 1, 0.25 do | |
1159 | RAW.C0 = CN(-0.15+0.05*i, 0, -0.5+0.15*i) * CA(MR(-140+10*i), 0, MR(10-3*i)) * CN(0, -0.4+0.1*i, 0) | |
1160 | wait() | |
1161 | end | |
1162 | for i = 0.15, 1, 0.15 do | |
1163 | RAW.C0 = CN(-0.1+0.1*i, 0, -0.35+0.25*i) * CA(MR(-130+115*i), 0, MR(7-7*i)) * CN(0, -0.3+0.25*i, 0) | |
1164 | wait() | |
1165 | end | |
1166 | for i = 0.33, 1, 0.33 do | |
1167 | RAW.C0 = CN(0, 0, -0.1+0.1*i) * CA(MR(-15+15*i), 0, 0) * CN(0, -0.05+0.05*i, 0) | |
1168 | wait() | |
1169 | end | |
1170 | Attach(Torso) | |
1171 | TW.Part1 = Handle | |
1172 | HW.Part1 = nil | |
1173 | RAW.Part1 = nil | |
1174 | LAW.Part1 = nil | |
1175 | end | |
1176 | ||
1177 | function ReloadFunc(once) | |
1178 | if Ammunition.Ammo < Ammunition.MaxAmmo and Selected and not Reloading and not Attacking and Ammunition.Ammoleft > 0 then | |
1179 | if not once then | |
1180 | ReloadHold = true | |
1181 | end | |
1182 | ReloadStart(once) | |
1183 | end | |
1184 | end | |
1185 | ||
1186 | function _onselected(mouse) | |
1187 | SelectAnim() | |
1188 | mouse.Icon = Icon | |
1189 | Selected = true | |
1190 | Notime(function() | |
1191 | for _, g in pairs(AccuracyGuis) do | |
1192 | g.Gui.Transparency = 0.2 | |
1193 | end | |
1194 | while Selected do | |
1195 | pcall(function() | |
1196 | for _, g in pairs(AccuracyGuis) do | |
1197 | g.Gui.Position = UD(0, mouse.X+g.props.offset.x+g.props.unit.x*(Accuracy.Momentum*11), 0, mouse.Y+g.props.offset.y+g.props.unit.y*(Accuracy.Momentum*11)) | |
1198 | end | |
1199 | end) | |
1200 | wait() | |
1201 | end | |
1202 | end) | |
1203 | mouse.Button1Down:connect(function() | |
1204 | if Selected and not Attacking and not Swinging then | |
1205 | if Reloading then | |
1206 | ReloadHold = false | |
1207 | else | |
1208 | if Ammunition.Ammo < 1 then | |
1209 | ReloadFunc(true) | |
1210 | else | |
1211 | ShootFunc((Pipe1.CFrame * CN(0, 0, 1.65)).p, mouse.Hit.p) | |
1212 | end | |
1213 | if Ammunition.Ammo < 1 and Ammunition.Ammoleft < 1 then | |
1214 | PlaySound(Sounds.Out) | |
1215 | end | |
1216 | end | |
1217 | end | |
1218 | end) | |
1219 | mouse.KeyDown:connect(function(key) | |
1220 | key = key:lower() | |
1221 | if Selected and not Attacking and not Swinging then | |
1222 | if key == "r" then | |
1223 | ReloadFunc() | |
1224 | elseif key == "e" then | |
1225 | Swing() | |
1226 | end | |
1227 | end | |
1228 | end) | |
1229 | mouse.KeyUp:connect(function(key) | |
1230 | key = key:lower() | |
1231 | if key == "r" then | |
1232 | ReloadHold = false | |
1233 | end | |
1234 | end) | |
1235 | end | |
1236 | ||
1237 | function onDeselected(mouse) | |
1238 | Selected = false | |
1239 | for _, g in pairs(AccuracyGuis) do | |
1240 | g.Gui.Transparency = 1 | |
1241 | end | |
1242 | DeselAnim() | |
1243 | end | |
1244 | ||
1245 | bin.Selected:connect( _onselected) | |
1246 | bin.Deselected:connect(onDeselected) |