SHOW:
|
|
- or go back to the newest paste.
1 | - | Players = game:GetService("nikimario99") |
1 | + | Players = game:GetService("timetodie23232223") |
2 | Me = Players.LocalPlayer | |
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 = 55 | |
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 | |
320 | m.Scale = Scale or V3(1,1,1) | |
321 | m.Parent = P | |
322 | return m | |
323 | end | |
324 | } | |
325 | ||
326 | for _,v in pairs(Sounds) do | |
327 | ContentProvider:Preload(v.Id) | |
328 | end | |
329 | ||
330 | function PlaySound(Sound, bool) | |
331 | Pitch = Sound.Pitch | |
332 | if bool then | |
333 | Pitch = MRA((Sound.Pitch*0.75)*1000, (Sound.Pitch*1.15)*1000)/1000 | |
334 | end | |
335 | local a = Instance.new("Sound") | |
336 | a.SoundId = Sound.Id | |
337 | a.Volume = Sound.Volume | |
338 | a.Pitch = Pitch | |
339 | a.Name = "FX" | |
340 | a.Parent = Torso | |
341 | a:play() | |
342 | Notime(function() | |
343 | wait(1) | |
344 | a:remove() | |
345 | end) | |
346 | end | |
347 | ||
348 | function GetParts(pos, dist) | |
349 | local parts = {} | |
350 | local function o(p) | |
351 | for _,v in pairs(p:children()) do | |
352 | if v:IsA("BasePart") then | |
353 | if (pos - v.Position).magnitude <= dist then | |
354 | table.insert(parts, {v, (pos - v.Position).magnitude, v.Anchored}) | |
355 | end | |
356 | end | |
357 | o(v) | |
358 | end | |
359 | end | |
360 | o(workspace) | |
361 | return parts | |
362 | end | |
363 | ||
364 | function GetHum(P) | |
365 | for _,v in pairs(P:children()) do | |
366 | if v:IsA("Humanoid") then | |
367 | if v.Health > 0 then | |
368 | return v | |
369 | end | |
370 | end | |
371 | end | |
372 | end | |
373 | ||
374 | function GetGroup(Pos, Distance, Hit) | |
375 | local tab = {} | |
376 | for _,v in pairs(workspace:children()) do | |
377 | local h = GetHum(v) | |
378 | local t = v:findFirstChild("Torso") | |
379 | if h and t and v ~= Hit.Parent then | |
380 | if (t.Position - Pos).magnitude <= Distance then | |
381 | table.insert(tab, {h, v, (t.Position - Pos).magnitude}) | |
382 | end | |
383 | end | |
384 | end | |
385 | if Hit then | |
386 | local h = GetHum(Hit.Parent) | |
387 | if h then | |
388 | table.insert(tab, {h, Hit.Parent, 0}) | |
389 | end | |
390 | end | |
391 | return tab | |
392 | end | |
393 | ||
394 | function Part(Par, Anc, Colli, Tran, Ref, Col, Siz) | |
395 | local p = Instance.new("Part") | |
396 | p.formFactor = "Custom" | |
397 | p.TopSurface = 0 | |
398 | p.BottomSurface = 0 | |
399 | p.Transparency = Tran | |
400 | p.Reflectance = Ref | |
401 | p.Anchored = Anc | |
402 | p.CanCollide = Colli | |
403 | p.BrickColor = Col | |
404 | p.Size = Siz | |
405 | p.Locked = true | |
406 | p.Parent = Par | |
407 | p:BreakJoints() | |
408 | return p | |
409 | end | |
410 | ||
411 | function Weld(P0, P1, C0, C1) | |
412 | local w = Instance.new("Weld") | |
413 | w.Part0 = P0 | |
414 | w.Part1 = P1 | |
415 | if C0 then | |
416 | w.C0 = C0 | |
417 | end | |
418 | if C1 then | |
419 | w.C1 = C1 | |
420 | end | |
421 | w.Parent = P0 | |
422 | return w | |
423 | end | |
424 | ||
425 | for _,v in pairs(Char:children()) do | |
426 | if v.Name == ModelName then | |
427 | v:remove() | |
428 | end | |
429 | end | |
430 | ||
431 | for _,v in pairs(Char:children()) do if v.Name == ModelName then v:remove() end end | |
432 | ||
433 | Model = Instance.new("Model") | |
434 | Model.Name = ModelName | |
435 | ||
436 | FTorso = Part(Model, false, false, 1, 0, Torso.BrickColor, V3(2, 2, 1)) | |
437 | FW = Weld(Torso, FTorso) | |
438 | ||
439 | RAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
440 | LAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
441 | RLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
442 | LLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
443 | ||
444 | RABW = Weld(Torso, RAB, CN(), CN(-1.5, -0.5, 0)) | |
445 | LABW = Weld(Torso, LAB, CN(), CN(1.5, -0.5, 0)) | |
446 | RLBW = Weld(Torso, RLB, CN(), CN(-0.5, 1, 0)) | |
447 | LLBW = Weld(Torso, LLB, CN(), CN(0.5, 1, 0)) | |
448 | ||
449 | RAW = Weld(RAB, nil, CN(), CN(0, 0.5, 0)) | |
450 | LAW = Weld(LAB, nil, CN(), CN(0, 0.5, 0)) | |
451 | RLW = Weld(RLB, nil, CN(), CN(0, 1, 0)) | |
452 | LLW = Weld(LLB, nil, CN(), CN(0, 1, 0)) | |
453 | ||
454 | TW = Weld(Torso, nil, CN(-0.4, -1.5, 0.7), CA(MR(55), MR(-90), MR(0))) | |
455 | ||
456 | local FH = Instance.new("Humanoid",Model) | |
457 | FH.PlatformStand = true | |
458 | FH.MaxHealth = math.huge | |
459 | FH.Health = math.huge | |
460 | ||
461 | pcall(function() Torso:findFirstChild("Shirt"):clone().Parent = Model end) | |
462 | ||
463 | local hh = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
464 | hh.Name = "Head" | |
465 | Weld(FTorso, hh) | |
466 | ||
467 | Weapon = Instance.new("Model") | |
468 | Weapon.Name = "Weapon" | |
469 | ||
470 | HB = Part(Weapon, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
471 | HBW = Weld(Rarm, HB, CN(0, -0.7, 0), CA(MR(-90), MR(180), 0)) | |
472 | HW = Weld(HB, nil, CA(MR(38), MR(-28), MR(-90)) * CN(0, -0.2, -3.8)) | |
473 | ||
474 | LHB = Part(Weapon, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
475 | LHBW = Weld(Larm, LHB, CN(0, -0.7, 0), CA(MR(-90), MR(180), 0)) | |
476 | LHW = Weld(LHB, nil, CA(MR(-2), MR(30), MR(-3)) * CN(-0.1, 0.32, -0.24)) | |
477 | LHWK = Weld(LHB, nil, CA(MR(170), 0, 0)) | |
478 | ||
479 | ||
480 | Handle = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.5, 0.9, 0.9)) | |
481 | TW.Part1 = Handle | |
482 | ||
483 | Handle2 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.5, 0.6, 1.6)) | |
484 | Weld(Handle, Handle2, CA(MR(-45), 0, 0), CN(0, 0.5, -0.4)) | |
485 | ||
486 | Handle3 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.5, 0.7, 1.3)) | |
487 | Weld(Handle2, Handle3, CA(MR(45), 0, 0), CN(0, -0.4, -0.9)) | |
488 | ||
489 | Pipe1 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.3, 0.3, 3.2)) | |
490 | Add.Block(Pipe1, V3(1,1,1), 0.08) | |
491 | Weld(Handle3, Pipe1, CN(0, 0.15, 1.6+0.55)) | |
492 | ||
493 | Pipe2 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.3, 0.3, 1.7)) | |
494 | Add.Block(Pipe2, V3(1,1,1), 0.08) | |
495 | Weld(Handle3, Pipe2, CN(0, -0.15, 0.85+0.55)) | |
496 | ||
497 | Pipe3 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.25, 0.25, 1.6)) | |
498 | Add.Block(Pipe3, V3(1,1,1), 0.065) | |
499 | Weld(Pipe2, Pipe3, CN(0, 0, 0.8+0.7)) | |
500 | ||
501 | Pump = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.45, 0.45, 1.1)) | |
502 | Add.Block(Pump, V3(1,1,1), 0.225/2) | |
503 | PumpWeld = Weld(Pipe2, Pump, CN(0, 0, 0.6), CN(0, 0, 0)) | |
504 | ||
505 | Pump2 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.5, 0.5, 0.3)) | |
506 | Add.Block(Pump, V3(1,1,1), 0.13) | |
507 | Weld(Pump, Pump2, CN(0, 0, -0.5)) | |
508 | ||
509 | for degrees = -20, 200, 20 do | |
510 | local Derp = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.2)) | |
511 | Add.Block(Derp, V3(0.4,0.6,0.4), 0.02) | |
512 | Weld(Handle3, Derp, CN(0, -0.45, -0.32) * CA(MR(degrees), 0, 0), CN(0, 0, -0.2)) | |
513 | end | |
514 | ||
515 | Derp = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.3)) | |
516 | Add.Block(Derp, V3(0.4,1,1), 0.02) | |
517 | Weld(Handle3, Derp, CN(0, 0, -0.32) * CA(MR(-20), 0, 0), CN(0, 0.45, -0.2)) | |
518 | ||
519 | Trigger = Part(Weapon, false, false, 0, 0, BN("Really black"), V3(0.2, 0.3, 0.2)) | |
520 | Add.Block(Trigger, V3(0.5, 0.9, 0.3), 0.02) | |
521 | TriggerWeld = Weld(Handle3, Trigger, CN(0, -0.45, -0.4) * CA(MR(2), 0, 0)) | |
522 | ||
523 | Aim = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.3, 0.2, 0.7)) | |
524 | Add.Block(Aim, V3(1,0.7,1), 0.05) | |
525 | Weld(Pipe1, Aim, CN(0, 0.12, 1.1)) | |
526 | ||
527 | Aim1 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.2)) | |
528 | Add.Block(Aim1, V3(0.3, 0.7, 0.5)) | |
529 | Weld(Aim, Aim1, CN(-.1, 0.1, -0.25)) | |
530 | ||
531 | Aim2 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.2)) | |
532 | Add.Block(Aim2, V3(0.3, 0.7, 0.5)) | |
533 | Weld(Aim, Aim2, CN(.1, 0.1, -0.25)) | |
534 | ||
535 | Aim3 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.2, 0.2)) | |
536 | Add.Block(Aim3, V3(0.3, 0.7, 0.5)) | |
537 | Weld(Aim, Aim3, CN(0, 0.1, 0.25)) | |
538 | ||
539 | BulletFlip = Part(Weapon, false, false, 0, 0, BN("Light grey"), V3(0.2, 0.3, 0.6)) | |
540 | Flip = Weld(Handle3, BulletFlip, CN(-0.18, 0.1, 0.2) * CA(0, MR(-10), 0)) | |
541 | ||
542 | ||
543 | ||
544 | BeltWelds = {} | |
545 | ||
546 | BeltK = nil | |
547 | for i = -0.5, 0.5, 1 do | |
548 | local Belt = Part(Weapon, false, false, 0, 0, BN("Black"), V3(2.1, 0.3, 0.2)) | |
549 | table.insert(BeltWelds, Weld(Torso, Belt, CN(0, -0.9, i))) | |
550 | end | |
551 | for i = 1, -1, -2 do | |
552 | local Belt = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.2, 0.3, 1.1)) | |
553 | table.insert(BeltWelds, Weld(Torso, Belt, CN(i, -0.9, 0))) | |
554 | BeltK = Belt | |
555 | end | |
556 | ||
557 | for i = -0.25, 0.25, 0.5 do | |
558 | local Pocket = Part(Weapon, false, false, 0, 0, BN("Black"), V3(1.1, 0.9, 0.2)) | |
559 | table.insert(BeltWelds, Weld(Torso, Pocket, CN(0.8, -1.2, -0.8) * CA(0, MR(-15), 0), CN(0, 0, i))) | |
560 | end | |
561 | ||
562 | for i = -0.5, 0.5, 1 do | |
563 | local Pocket = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.6, 0.9, 0.2)) | |
564 | table.insert(BeltWelds, Weld(Torso, Pocket, CN(0.8, -1.2, -0.8) * CA(0, MR(-15)+MP/2, 0), CN(0, 0, i))) | |
565 | end | |
566 | Pocket = Part(Weapon, false, false, 0, 0, BN("Black"), V3(1.1, 0.2, 0.6)) | |
567 | table.insert(BeltWelds, Weld(Torso, Pocket, CN(0.8, -1.6, -0.8) * CA(0, MR(-15), 0))) | |
568 | ||
569 | function Shell(P) | |
570 | local Shel = Instance.new("Model") | |
571 | local Back = Part(Shel, false, false, 0, 0, BN("Bright yellow"), V3(0.3, 0.3, 0.25)) | |
572 | local Main = Part(Shel, false, false, 0, 0, BN("Bright red"), V3(0.3, 0.3, 0.4)) | |
573 | Add.Block(Back, V3(1,1,1), 0.077) | |
574 | Add.Block(Main, V3(1,1,1), 0.077) | |
575 | Weld(Main, Back, CN(0, 0, -0.225)) | |
576 | Shel.Parent = P | |
577 | return {Model = Shel, Back = Back, Main = Main} | |
578 | end | |
579 | ||
580 | for y = 0.15, 0.65, 0.25 do | |
581 | for x = -0.12, 0.13, 0.24 do | |
582 | for z = -0.25, 0.26, 0.5 do | |
583 | local sh = Shell(Weapon) | |
584 | Weld(Pocket, sh.Main, CN(z-0.05, y, x), CA(0, MP/2, 0)) | |
585 | end | |
586 | end | |
587 | end | |
588 | ||
589 | KnifeSheath = Part(Weapon, false, false, 0, 0, BN("Black"), V3(0.3, 0.9, 0.6)) | |
590 | SheathWeld = Weld(BeltK, KnifeSheath, CN(-0.2, -0.3, -0.25) * CA(MR(-20), 0, 0)) | |
591 | ||
592 | KnifeHandle = Part(Weapon, false, false, 0, 0, BN("Really black"), V3(0.3, 0.6, 0.3)) | |
593 | KnifeWeld = Weld(KnifeSheath, KnifeHandle, CA(MP, 0, 0), CN(0, 0.9, 0)) | |
594 | ||
595 | KnifeHandle2 = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(0.3, 0.2, 0.4)) | |
596 | Weld(KnifeHandle, KnifeHandle2, CN(0, 0.35, 0)) | |
597 | ||
598 | KnifeBlade1 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.2, 0.8, 0.3)) | |
599 | Add.Block(KnifeBlade1, V3(0.4, 1, 1), 0.05) | |
600 | Weld(KnifeHandle2, KnifeBlade1, CN(0, 0.42, 0)) | |
601 | ||
602 | KnifeBlade2 = Part(Weapon, false, false, 0, 0.1, BN("Light grey"), V3(0.2, 0.24, 0.24)) | |
603 | Add.Block(KnifeBlade2, V3(0.4, 1, 1), 0.05) | |
604 | Weld(KnifeBlade1, KnifeBlade2, CN(0, 0.32, 0), CA(MR(45), 0, 0)) | |
605 | ||
606 | function Show_Damage(P, D, Area) | |
607 | local mo = Instance.new("Model") | |
608 | mo.Name = D | |
609 | local p = Part(mo, true, false, 0, 0, BN("Bright red"), V3(0.2, 0.2, 0.2)) | |
610 | p.Name = "Head" | |
611 | local m = Instance.new("SpecialMesh") | |
612 | m.MeshType = "Brick" | |
613 | m.Scale = Vector3.new(3.5, 2.3, 3.5) | |
614 | m.Parent = p | |
615 | local h = Instance.new("Humanoid") | |
616 | h.Health = 0 | |
617 | h.MaxHealth = 0 | |
618 | h.Name = "asd" | |
619 | h.Parent = mo | |
620 | local nah = true | |
621 | mo.Parent = workspace | |
622 | local cf = CN(P) * CN(MRA(-Area*100, Area*100)/100, MRA(-Area*100, Area*100)/100, MRA(-Area*100, Area*100)/100) | |
623 | p.CFrame = cf | |
624 | Notime(function() | |
625 | Notime(function() | |
626 | for i = 0, 6, 0.03 do | |
627 | wait() | |
628 | p.CFrame = cf * CN(0, i, 0) | |
629 | end | |
630 | end) | |
631 | wait(1.5) | |
632 | for i = 0, 1, 0.05 do | |
633 | p.Transparency = i | |
634 | if nah then mo.Name = "" nah = false else mo.Name = "- "..D nah = true end | |
635 | wait() | |
636 | end | |
637 | mo:remove() | |
638 | end) | |
639 | end | |
640 | ||
641 | function Hit(part) | |
642 | local H = GetHum(part.Parent) | |
643 | if H and Debounce and Hurt then | |
644 | Debounce = false | |
645 | local Dmg = MRA(MeleeDmg/1.3, MeleeDmg) | |
646 | H.Health = H.Health - Dmg | |
647 | Show_Damage(KnifeBlade2.Position, Dmg, 0.1) | |
648 | end | |
649 | end | |
650 | ||
651 | KnifeBlade1.Touched:connect(Hit) | |
652 | KnifeBlade2.Touched:connect(Hit) | |
653 | ||
654 | Weapon.Parent = Model | |
655 | Model.Parent = Char | |
656 | ||
657 | if script.Parent.className ~= "HopperBin" then | |
658 | h = Instance.new("HopperBin", Me.Backpack) | |
659 | h.Name = ToolName | |
660 | script.Parent = h | |
661 | end | |
662 | ||
663 | bin = script.Parent | |
664 | ||
665 | function Attach(t) | |
666 | RSH.Part0 = t | |
667 | LSH.Part0 = t | |
668 | RH.Part0 = t | |
669 | LH.Part0 = t | |
670 | RABW.Part0 = t | |
671 | LABW.Part0 = t | |
672 | LLBW.Part0 = t | |
673 | RLBW.Part0 = t | |
674 | for _,v in pairs(BeltWelds) do | |
675 | v.Part0 = t | |
676 | end | |
677 | if t == Torso then | |
678 | FTorso.Transparency = 1 | |
679 | else | |
680 | Torso.Transparency = 1 | |
681 | end | |
682 | t.Transparency = 0 | |
683 | end | |
684 | ||
685 | function Normal() | |
686 | RAW.C0 = CA(MR(90), 0, MR(-65)) * CN(0.6, -0.9, 0) | |
687 | LAW.C0 = CA(MR(85), 0, MR(-40)) * CN(0.5, -0.5, 0) | |
688 | FW.C0 = CA(0, MR(-70), 0) | |
689 | HW.C0 = CA(MR(0), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
690 | LHW.C0 = CA(MR(-2), MR(30), MR(-3)) * CN(-0.1, 0.32, -0.24) | |
691 | PumpWeld.C1 = CN(0, 0, 0) | |
692 | Flip.C1 = CN(0, 0, 0) | |
693 | Attach(FTorso) | |
694 | LHW.Part1 = nil | |
695 | TW.Part1 = nil | |
696 | LHWK.Part1 = nil | |
697 | KnifeWeld.Part1 = KnifeHandle | |
698 | Neck.C0 = necko | |
699 | HW.Part1 = Handle | |
700 | end | |
701 | ||
702 | function Swing() | |
703 | Swinging = true | |
704 | for i = 0.5, 1, 0.5 do | |
705 | LAW.C0 = CA(MR(85-8*i), 0, MR(-40+5*i)) * CN(0.5, -0.5+0.2*i, 0) | |
706 | 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) | |
707 | HW.C0 = CA(MR(-5*i), MR(5+5*i), MR(0)) * CN(0.4, 0, -1.2) | |
708 | FW.C0 = CA(0, MR(-70+8*i), 0) | |
709 | wait() | |
710 | end | |
711 | for i = 0.33, 1, 0.33 do | |
712 | LAW.C0 = CA(MR(77-37*i), 0, MR(-35+30*i)) * CN(0.5-0.15*i, -0.3+0.3*i, 0) | |
713 | 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) | |
714 | HW.C0 = CA(MR(-5-15*i), MR(10+10*i), MR(0)) * CN(0.4, 0, -1.2) | |
715 | FW.C0 = CA(0, MR(-62+58*i), 0) | |
716 | wait() | |
717 | end | |
718 | LHWK.Part1 = KnifeHandle | |
719 | KnifeWeld.Part1 = nil | |
720 | PlaySound(Sounds.Slash) | |
721 | for i = 0.25, 1, 0.25 do | |
722 | LAW.C0 = CA(MR(40+30*i), 0, MR(-5-45*i)) * CN(0.35-0.2*i, -0.5*i, 0) | |
723 | 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) | |
724 | HW.C0 = CA(MR(-20-10*i), MR(20+5*i), MR(0)) * CN(0.4, 0, -1.2) | |
725 | FW.C0 = CA(0, MR(-4+14*i), 0) | |
726 | LHWK.C0 = CN(0, -0.1*i, 0.2*i) * CA(MR(170), 0, MR(-50*i)) | |
727 | wait() | |
728 | end | |
729 | Hurt = true | |
730 | Debounce = true | |
731 | for i = 0.25, 1, 0.25 do | |
732 | LAW.C0 = CA(MR(70+20*i), 0, MR(-50+35*i)) * CN(0.15-0.05*i, -0.5-0.3*i, 0) | |
733 | FW.C0 = CA(0, MR(10-60*i), 0) | |
734 | LHWK.C0 = CN(0, -0.1-0.05*i, 0.2+0.1*i) * CA(MR(170), 0, MR(-50-40*i)) | |
735 | wait() | |
736 | end | |
737 | for i = 0.25, 1, 0.25 do | |
738 | LAW.C0 = CA(MR(90+10*i), 0, MR(-15+15*i)) * CN(0.1, -0.9, 0) | |
739 | FW.C0 = CA(0, MR(-50-40*i), 0) | |
740 | LHWK.C0 = CN(0, -0.15, 0.3) * CA(MR(170), 0, MR(-90)) | |
741 | wait() | |
742 | end | |
743 | for i = 0.33, 1, 0.33 do | |
744 | LAW.C0 = CA(MR(100+3*i), 0, 0) * CN(0.1, -0.9, 0) | |
745 | FW.C0 = CA(0, MR(-90-6*i), 0) | |
746 | LHWK.C0 = CN(0, -0.15, 0.3) * CA(MR(170), 0, MR(-90)) | |
747 | wait() | |
748 | end | |
749 | Hurt = false | |
750 | wait(0.04) | |
751 | for i = 0.25, 1, 0.25 do | |
752 | LAW.C0 = CA(MR(103-13*i), 0, 0) * CN(0.1, -0.9+0.1*i, 0) | |
753 | FW.C0 = CA(0, MR(-96+16*i), 0) | |
754 | LHWK.C0 = CN(0, -0.15, 0.3-0.1*i) * CA(MR(170), 0, MR(-90+15*i)) | |
755 | wait() | |
756 | end | |
757 | for i = 0.25, 1, 0.25 do | |
758 | LAW.C0 = CA(MR(90-42*i), 0, 0) * CN(0.1+0.1*i, -0.8+0.3*i, 0) | |
759 | 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) | |
760 | FW.C0 = CA(0, MR(-80+10*i), 0) | |
761 | HW.C0 = CA(MR(-30+20*i), MR(25-15*i), MR(0)) * CN(0.4, 0, -1.2) | |
762 | LHWK.C0 = CN(0, -0.15, 0.2-0.45*i) * CA(MR(170), 0, MR(-75+75*i)) | |
763 | wait() | |
764 | end | |
765 | for i = 0.5, 1, 0.5 do | |
766 | LAW.C0 = CA(MR(48-8*i), 0, 0) * CN(0.2+0.05*i, -0.5, 0) | |
767 | 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) | |
768 | FW.C0 = CA(0, MR(-70), 0) | |
769 | HW.C0 = CA(MR(-10+10*i), MR(10-5*i), MR(0)) * CN(0.4, 0, -1.2) | |
770 | LHWK.C0 = CN(0, -0.15, -0.25-0.15*i) * CA(MR(170), 0, 0) | |
771 | wait() | |
772 | end | |
773 | LHWK.Part1 = nil | |
774 | KnifeWeld.Part1 = KnifeHandle | |
775 | for i = 0.25, 1, 0.25 do | |
776 | LAW.C0 = CA(MR(40+40*i), 0, MR(-30*i)) * CN(0.25+0.2*i, -0.5, 0) | |
777 | 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) | |
778 | wait() | |
779 | end | |
780 | for i = 0.5, 1, 0.5 do | |
781 | 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) | |
782 | RAW.C0 = CA(MR(90), 0, MR(-65)) * CN(0.6, -0.9, 0) | |
783 | wait() | |
784 | end | |
785 | Normal() | |
786 | Swinging = false | |
787 | end | |
788 | ||
789 | function Reload(once) | |
790 | while Ammunition.Ammo < Ammunition.MaxAmmo and Ammunition.Ammoleft > 0 do | |
791 | wait() | |
792 | for i = 0.33, 1, 0.33 do | |
793 | RAW.C0 = CA(MR(45-2*i), 0, MR(-15)) * CN(0, -0.15-0.05*i, 0) | |
794 | LAW.C0 = CA(MR(50), MR(40), MR(-15)) * CN(0.5, -0.5, 0) | |
795 | LHW.C0 = CA(MR(-35), MR(60), MR(-45)) * CN(-0.6, 0.2, -0.24) | |
796 | wait() | |
797 | end | |
798 | for i = 0.25, 1, 0.25 do | |
799 | RAW.C0 = CA(MR(43-8*i), 0, MR(-15)) * CN(0, -0.2-0.2*i, 0) | |
800 | LAW.C0 = CA(MR(50), MR(40), MR(-15)) * CN(0.5, -0.5, 0) | |
801 | LHW.C0 = CA(MR(-35), MR(60), MR(-45)) * CN(-0.6, 0.2, -0.24) | |
802 | wait() | |
803 | end | |
804 | for i = 0.5, 1, 0.5 do | |
805 | RAW.C0 = CA(MR(35-2*i), 0, MR(-15)) * CN(0, -0.4-0.05*i, 0) | |
806 | wait() | |
807 | end | |
808 | local shel = Shell(Weapon) | |
809 | local w = Weld(Rarm, shel.Main, CN(0, -1.25, 0.45), CA(MR(-140), 0, MR(60))) | |
810 | for i = 0.25, 1, 0.25 do | |
811 | RAW.C0 = CA(MR(33+20*i), 0, MR(-15-10*i)) * CN(0, -0.45+0.2*i, 0) | |
812 | LAW.C0 = CA(MR(50-5*i), MR(40), MR(-15+5*i)) * CN(0.5, -0.5, 0) | |
813 | w.C0 = CN(-0.1*i, -1.25, 0.45-0.25*i) | |
814 | wait() | |
815 | end | |
816 | for i = 0.2, 1, 0.2 do | |
817 | RAW.C0 = CA(MR(53+32*i), 0, MR(-25-12*i)) * CN(0, -0.25-0.3*i, 0) | |
818 | LAW.C0 = CA(MR(45), MR(40), MR(-10+10*i)) * CN(0.5, -0.5+0.15*i, 0) | |
819 | w.C0 = CN(-0.1-0.1*i, -1.25, 0.2-0.3*i) | |
820 | w.C1 = CA(MR(-140+50*i), 0, MR(60)) | |
821 | wait() | |
822 | end | |
823 | PlaySound(Sounds.Reload, false) | |
824 | for i = 0.25, 1, 0.25 do | |
825 | RAW.C0 = CA(MR(85+10*i), 0, MR(-42-8*i)) * CN(0, -0.55-0.1*i, 0) | |
826 | LAW.C0 = CA(MR(45), MR(40), 0) * CN(0.5, -0.35, 0) | |
827 | w.C0 = CN(-0.2-0.05*i, -1.25, -0.1-0.1*i) | |
828 | wait() | |
829 | end | |
830 | shel.Model:remove() shell = nil | |
831 | Ammunition.Ammo = Ammunition.Ammo + 1 | |
832 | Ammunition.Ammoleft = Ammunition.Ammoleft - 1 | |
833 | wait(0.1) | |
834 | for i = 0.33, 1, 0.33 do | |
835 | RAW.C0 = CA(MR(95-10*i), 0, MR(-50+10*i)) * CN(0, -0.65+0.1*i, 0) | |
836 | LAW.C0 = CA(MR(45+5*i), MR(40), MR(-12*i)) * CN(0.5, -0.35-0.1*i, 0) | |
837 | wait() | |
838 | end | |
839 | for i = 0.25, 1, 0.25 do | |
840 | RAW.C0 = CA(MR(85-40*i), 0, MR(-40+25*i)) * CN(0, -0.55+0.4*i, 0) | |
841 | LAW.C0 = CA(MR(50), MR(40), MR(-12-3*i)) * CN(0.5, -0.45-0.05*i, 0) | |
842 | wait() | |
843 | end | |
844 | if once then break end | |
845 | if not ReloadHold then break end | |
846 | end | |
847 | for i = 0.33, 1, 0.33 do | |
848 | RAW.C0 = CA(MR(45+10*i), 0, MR(-15-10*i)) * CN(0.1*i, -0.15-0.1*i, 0) | |
849 | LAW.C0 = CA(MR(52+12*i), MR(40-5*i), MR(-15-5*i)) * CN(0.5, -0.5, 0) | |
850 | 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) | |
851 | wait() | |
852 | end | |
853 | for i = 0.2, 1, 0.2 do | |
854 | RAW.C0 = CA(MR(55+30*i), 0, MR(-25-30*i)) * CN(0.1+0.4*i, -0.25-0.55*i, 0) | |
855 | LAW.C0 = CA(MR(70+10*i), MR(35-30*i), MR(-20-15*i)) * CN(0.5, -0.5, 0) | |
856 | 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) | |
857 | wait() | |
858 | end | |
859 | for i = 0.25, 1, 0.25 do | |
860 | RAW.C0 = CA(MR(85+5*i), 0, MR(-55-10*i)) * CN(0.5+0.1*i, -0.8-0.1*i, 0) | |
861 | LAW.C0 = CA(MR(80+5*i), MR(5-5*i), MR(-35-5*i)) * CN(0.5, -0.5, 0) | |
862 | 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) | |
863 | wait() | |
864 | end | |
865 | end | |
866 | ||
867 | function ReloadStart(once) | |
868 | Reloading = true | |
869 | HW.Part1 = nil | |
870 | LHW.Part1 = Pipe2 | |
871 | for i = 0.25, 1, 0.25 do | |
872 | RAW.C0 = CA(MR(90-10*i), 0, MR(-65+10*i)) * CN(0.6-0.2*i, -0.9+0.15*i, 0) | |
873 | LAW.C0 = CA(MR(85-5*i), MR(7*i), MR(-40+5*i)) * CN(0.5, -0.5, 0) | |
874 | 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) | |
875 | wait() | |
876 | end | |
877 | for i = 0.15, 1, 0.15 do | |
878 | RAW.C0 = CA(MR(80-35*i), 0, MR(-55+40*i)) * CN(0.4-0.4*i, -0.75+0.6*i, 0) | |
879 | LAW.C0 = CA(MR(80-30*i), MR(7+33*i), MR(-35+20*i)) * CN(0.5, -0.5, 0) | |
880 | 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) | |
881 | wait() | |
882 | end | |
883 | Reload(once) | |
884 | Normal() | |
885 | Reloading = false | |
886 | end | |
887 | ||
888 | function AimEet() | |
889 | end | |
890 | ||
891 | function Shoot(Start, To) | |
892 | 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)) | |
893 | for Pellets = 1, 8 do | |
894 | local Power = 20 | |
895 | local Drop = 0.2 | |
896 | local Face = CN(Start, To) * Accu * CA(MR(MRA(-10000, 10000)/2500), MR(MRA(-10000, 10000)/2500), MR(MRA(-10000, 10000)/2500)) | |
897 | local Pellet = Part(PelletModel, true, false, 0, 0, BN("Dark grey"), V3(0.2, 0.2, 0.3)) | |
898 | Pellet.CFrame = Face | |
899 | local LastPoint = Face.p | |
900 | Notime(function() | |
901 | local HitObj | |
902 | local HitPos | |
903 | local DistThing = 250 | |
904 | for Distance = Power, 600, Power do | |
905 | Face = Face * CA(MR(-Drop), 0, 0) * CN(0, 0, -Power) | |
906 | local PointNow = Face.p | |
907 | local Hit, Pos = RayC(LastPoint, PointNow, Power+2, EffectModel) | |
908 | if Hit then | |
909 | DistThing = Distance | |
910 | if DistThing > 250 then DistThing = 200 end | |
911 | PointNow = Pos | |
912 | HitPos = Pos | |
913 | HitObj = Hit | |
914 | end | |
915 | local Dist = (PointNow - LastPoint).magnitude | |
916 | Pellet.CFrame = Face | |
917 | Drop = Drop + 0.04 | |
918 | local Effect = Part(EffectModel, true, false, 0, 0, BN("White"), V3(0.2, 0.2, 0.2)) | |
919 | Effect.CFrame = CN(LastPoint, PointNow) * CA(MR(-90), 0, 0) * CN(0, Dist/2, 0) | |
920 | local H = Add.Head(Effect, V3(0.8, Dist*5, 0.8)) | |
921 | LastPoint = Face.p | |
922 | Power = Power - Drop/3 | |
923 | Notime(function() | |
924 | for i = 0, 1, 0.2 do | |
925 | wait() | |
926 | Effect.Transparency = i | |
927 | end | |
928 | Effect:remove() | |
929 | end) | |
930 | if Hit then | |
931 | Pellet.CFrame = CN(Pos) | |
932 | break | |
933 | end | |
934 | wait() | |
935 | end | |
936 | Pellet:remove() | |
937 | if HitObj then | |
938 | local Surface = DetectSurface(HitPos, HitObj) | |
939 | local C = CN(HitPos) * CA(HitObj.CFrame:toEulerAnglesXYZ()) * Surface[2] | |
940 | if Surface[1] == "Anything" then | |
941 | C = Surface[2] | |
942 | end | |
943 | local H = nil | |
944 | if HitObj.Parent ~= workspace then | |
945 | H = GetHum(HitObj.Parent) | |
946 | if HitObj.Parent.Parent ~= workspace and H == nil then | |
947 | H = GetHum(HitObj.Parent.Parent) | |
948 | end | |
949 | end | |
950 | if H then | |
951 | local Dmg = DistThing/200 | |
952 | Dmg = (1-Dmg)*15 | |
953 | Dmg = MRA(Dmg*850, Dmg*1100)/1000 | |
954 | H.Health = H.Health - Dmg | |
955 | PlaySound(Sounds.Hit) | |
956 | Show_Damage(HitObj.Position, math.floor(Dmg), 1.5) | |
957 | else | |
958 | PlaySound(Sounds.PartHit) | |
959 | local BulletHole = Part(EffectModel, true, false, 1, 0, BN("White"), V3(0.8, 0.2, 0.8)) | |
960 | BulletHole.CFrame = C * CN(0, -0.085, 0) | |
961 | local Dec = Instance.new("Decal",BulletHole) | |
962 | Dec.Texture = Images[MRA(1,#Images)] | |
963 | Dec.Face = "Top" | |
964 | if not HitObj.Anchored then | |
965 | BulletHole.Anchored = false | |
966 | local W = Weld(HitObj, BulletHole, HitObj.CFrame:toObjectSpace(C)) | |
967 | end | |
968 | Notime(function() | |
969 | wait(MRA(700, 15000)/100) | |
970 | BulletHole:remove() | |
971 | end) | |
972 | end | |
973 | end | |
974 | end) | |
975 | end | |
976 | end | |
977 | ||
978 | function ShootAnim(From, To) | |
979 | Shoot(From, To) | |
980 | AddInaccuracy(16) | |
981 | PlaySound(Sounds.Fire, false) | |
982 | for i = 0.33, 1, 0.33 do | |
983 | RAW.C0 = CA(MR(90+10*i), 0, MR(-65)) * CN(0.6, -0.9+0.5*i, 0) | |
984 | LAW.C0 = CA(MR(85+26*i), 0, MR(-40)) * CN(0.5, -0.5+0.1*i, 0) | |
985 | HW.C0 = CA(MR(-15*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
986 | wait() | |
987 | end | |
988 | for i = 0.2, 1, 0.2 do | |
989 | RAW.C0 = CA(MR(100+5*i), 0, MR(-65)) * CN(0.6, -0.4+0.15*i, 0) | |
990 | LAW.C0 = CA(MR(111+4*i), 0, MR(-40)) * CN(0.5, -0.4+0.05*i, 0) | |
991 | HW.C0 = CA(MR(-15-2*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
992 | wait() | |
993 | end | |
994 | for i = 0.5, 1, 0.5 do | |
995 | RAW.C0 = CA(MR(105+2*i), 0, MR(-65)) * CN(0.6, -0.25+0.03*i, 0) | |
996 | LAW.C0 = CA(MR(115+2*i), 0, MR(-40)) * CN(0.5, -0.35+0.02*i, 0) | |
997 | HW.C0 = CA(MR(-17), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
998 | wait() | |
999 | end | |
1000 | for i = 0.2, 1, 0.2 do | |
1001 | RAW.C0 = CA(MR(107-12*i), 0, MR(-65)) * CN(0.6, -0.22-0.68*i, 0) | |
1002 | LAW.C0 = CA(MR(117-17*i), 0, MR(-40)) * CN(0.5, -0.33-0.02*i, 0) | |
1003 | HW.C0 = CA(MR(-17+2*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
1004 | wait() | |
1005 | end | |
1006 | for i = 0.33, 1, 0.33 do | |
1007 | RAW.C0 = CA(MR(95-5*i), 0, MR(-65)) * CN(0.6, -0.9-0.1*i, 0) | |
1008 | LAW.C0 = CA(MR(100-5*i), 0, MR(-40)) * CN(0.5+0.1*i, -0.35+0.1*i, 0) | |
1009 | HW.C0 = CA(MR(-15+11*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
1010 | PumpWeld.C1 = CN(0, 0, 0.1*i) | |
1011 | wait() | |
1012 | end | |
1013 | for i = 0.33, 1, 0.33 do | |
1014 | RAW.C0 = CA(MR(90-3*i), 0, MR(-65)) * CN(0.6, -1+0.05*i, 0) | |
1015 | LAW.C0 = CA(MR(95-5*i), 0, MR(-40)) * CN(0.6+0.2*i, -0.25+0.35*i, 0) | |
1016 | HW.C0 = CA(MR(-4+4*i), MR(5), MR(0)) * CN(0.4, 0, -1.2) | |
1017 | PumpWeld.C1 = CN(0, 0, 0.1+0.6*i) | |
1018 | Flip.C1 = CN(0, 0, 0.5*i) | |
1019 | wait() | |
1020 | end | |
1021 | local sh = Shell(workspace) | |
1022 | sh.Main.CanCollide = true | |
1023 | sh.Back.CanCollide = true | |
1024 | sh.Main.CFrame = Handle3.CFrame * CN(0.3, 0.2, 0) | |
1025 | sh.Main.Velocity = (Handle3.CFrame * CA(0, MR(90), 0)).lookVector * 15 | |
1026 | Notime(function() | |
1027 | wait(MRA(100,180)/10) | |
1028 | for i = 0, 1, 0.005 do | |
1029 | sh.Main.Transparency = i | |
1030 | sh.Back.Transparency = i | |
1031 | wait() | |
1032 | end | |
1033 | sh.Model:remove() | |
1034 | end) | |
1035 | for i = 0.33, 1, 0.33 do | |
1036 | RAW.C0 = CA(MR(87+3*i), 0, MR(-65)) * CN(0.6, -0.95+0.05*i, 0) | |
1037 | LAW.C0 = CA(MR(90-5*i), 0, MR(-40)) * CN(0.8-0.3*i, 0.1-0.6*i, 0) | |
1038 | HW.C0 = CA(0, MR(5), 0) * CN(0.4, 0, -1.2) | |
1039 | PumpWeld.C1 = CN(0, 0, 0.7-0.7*i) | |
1040 | Flip.C1 = CN(0, 0, 0.5-0.5*i) | |
1041 | wait() | |
1042 | end | |
1043 | Normal() | |
1044 | end | |
1045 | ||
1046 | function ShootFunc(From, To) | |
1047 | local H, Pos = RayC(From, To, 10, EffectModel) | |
1048 | local Can = true | |
1049 | if H then | |
1050 | if H:IsDescendantOf(Char) then | |
1051 | Can = false | |
1052 | end | |
1053 | end | |
1054 | if Can then | |
1055 | Attacking = true | |
1056 | Ammunition.Ammo = Ammunition.Ammo - 1 | |
1057 | if Ammunition.Ammo < 0 then Ammunition.Ammo = 0 end | |
1058 | ShootAnim(From, To) | |
1059 | Attacking = false | |
1060 | end | |
1061 | end | |
1062 | ||
1063 | function SelectAnim() | |
1064 | RAW.Part1 = Rarm | |
1065 | for i = 0.25, 1, 0.25 do | |
1066 | RAW.C0 = CA(MR(-10*i), 0, MR(2*i)) | |
1067 | wait() | |
1068 | end | |
1069 | for i = 0.1, 1, 0.1 do | |
1070 | 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) | |
1071 | wait() | |
1072 | end | |
1073 | for i = 0.25, 1, 0.25 do | |
1074 | RAW.C0 = CN(-0.15, 0, -0.45-0.05*i) * CA(MR(-125-15*i), 0, MR(10)) * CN(0, -0.4, 0) | |
1075 | wait() | |
1076 | end | |
1077 | TW.Part1 = nil | |
1078 | HW.Part1 = Handle | |
1079 | for i = 0.25, 1, 0.25 do | |
1080 | 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) | |
1081 | HW.C0 = CA(MR(38+12*i), MR(-28-15*i), MR(-90-10*i)) * CN(0, -0.1*i, -3.8) | |
1082 | wait() | |
1083 | end | |
1084 | Attach(FTorso) | |
1085 | for i = 0.1, 1, 0.1 do | |
1086 | 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) | |
1087 | 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) | |
1088 | FW.C0 = CA(0, MR(-15*i), 0) | |
1089 | wait() | |
1090 | end | |
1091 | LAW.Part1 = Larm | |
1092 | for i = 0.15, 1, 0.15 do | |
1093 | RAW.C0 = CN(0, 0, -0.1+0.1*i) * CA(MR(-40+60*i), 0, MR(42+4*i)) | |
1094 | LAW.C0 = CA(MR(10*i), 0, MR(-8*i)) * CN(0, -0.15*i, 0) | |
1095 | FW.C0 = CA(0, MR(-15-20*i), 0) | |
1096 | HW.C0 = CA(MR(80+50*i), MR(-93-57*i), MR(-150-30*i)) * CN(0, -0.8, -3.1+1*i) | |
1097 | wait() | |
1098 | end | |
1099 | for i = 0.15, 1, 0.15 do | |
1100 | RAW.C0 = CA(MR(20+58*i), 0, MR(46-60*i)) * CN(0.2*i, -0.35*i, 0) | |
1101 | LAW.C0 = CA(MR(10+65*i), 0, MR(-8-32*i)) * CN(0.3*i, -0.15-0.25*i, 0) | |
1102 | FW.C0 = CA(0, MR(-35-30*i), 0) | |
1103 | 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) | |
1104 | wait() | |
1105 | end | |
1106 | for i = 0.2, 1, 0.2 do | |
1107 | RAW.C0 = CA(MR(78+8*i), 0, MR(-14-41*i)) * CN(0.2+0.35*i, -0.35-0.55*i, 0) | |
1108 | LAW.C0 = CA(MR(75+7*i), 0, MR(-40)) * CN(0.3+0.15*i, -0.4-0.06*i, 0) | |
1109 | FW.C0 = CA(0, MR(-65-5*i), 0) | |
1110 | HW.C0 = CA(MR(0), MR(-10+10*i), MR(0)) * CN(0.25+0.1*i, -0.5+0.4*i, -1.2) | |
1111 | wait() | |
1112 | end | |
1113 | for i = 0.25, 1, 0.25 do | |
1114 | RAW.C0 = CA(MR(86+4*i), 0, MR(-55-10*i)) * CN(0.55+0.05*i, -0.8-0.1*i, 0) | |
1115 | LAW.C0 = CA(MR(82+3*i), 0, MR(-40)) * CN(0.45+0.05*i, -0.46-0.04*i, 0) | |
1116 | FW.C0 = CA(0, MR(-70), 0) | |
1117 | HW.C0 = CA(MR(0), MR(5*i), MR(0)) * CN(0.35+0.05*i, -0.1+0.1*i, -1.2) | |
1118 | wait() | |
1119 | end | |
1120 | end | |
1121 | ||
1122 | function DeselAnim() | |
1123 | for i = 0.25, 1, 0.25 do | |
1124 | RAW.C0 = CA(MR(90-10*i), 0, MR(-65+10*i)) * CN(0.6-0.05*i, -0.9+0.35*i, 0) | |
1125 | LAW.C0 = CA(MR(85-10*i), 0, MR(-40+4*i)) * CN(0.5-0.05*i, -0.5+0.04*i, 0) | |
1126 | FW.C0 = CA(0, MR(-70+10*i), 0) | |
1127 | 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) | |
1128 | wait() | |
1129 | end | |
1130 | for i = 0.07, 1, 0.07 do | |
1131 | RAW.C0 = CA(MR(80-80*i), 0, MR(-55+90*i)) * CN(0.55-0.35*i, -0.55+0.55*i, 0) | |
1132 | LAW.C0 = CA(MR(75-70*i), 0, MR(-36+30*i)) * CN(0.45-0.35*i, -0.46+0.36*i, 0) | |
1133 | FW.C0 = CA(0, MR(-60+40*i), 0) | |
1134 | 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) | |
1135 | wait() | |
1136 | end | |
1137 | for i = 0.25, 1, 0.25 do | |
1138 | 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) | |
1139 | LAW.C0 = CA(MR(5-5*i), 0, MR(-6+6*i)) * CN(0.1-0.1*i, -0.1+0.1*i, 0) | |
1140 | FW.C0 = CA(0, MR(-20+15*i), 0) | |
1141 | HW.C0 = CA(MR(100-20*i), MR(-105+15*i), MR(100-15*i)) * CN(0, -0.2, -2.2-0.3*i) | |
1142 | wait() | |
1143 | end | |
1144 | LAW.Part1 = nil | |
1145 | for i = 0.12, 1, 0.12 do | |
1146 | 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) | |
1147 | FW.C0 = CA(0, MR(-5+5*i), 0) | |
1148 | HW.C0 = CA(MR(80-37*i), MR(-90+55*i), MR(85-135*i)) * CN(0, -0.2, -2.5-0.9*i) | |
1149 | wait() | |
1150 | end | |
1151 | Attach(Torso) | |
1152 | for i = 0.2, 1, 0.2 do | |
1153 | 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) | |
1154 | HW.C0 = CA(MR(43-5*i), MR(-35+7*i), MR(-50-40*i)) * CN(0, -0.2, -3.4-0.4*i) | |
1155 | wait() | |
1156 | end | |
1157 | TW.Part1 = Handle | |
1158 | HW.Part1 = nil | |
1159 | for i = 0.25, 1, 0.25 do | |
1160 | 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) | |
1161 | wait() | |
1162 | end | |
1163 | for i = 0.15, 1, 0.15 do | |
1164 | 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) | |
1165 | wait() | |
1166 | end | |
1167 | for i = 0.33, 1, 0.33 do | |
1168 | 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) | |
1169 | wait() | |
1170 | end | |
1171 | Attach(Torso) | |
1172 | TW.Part1 = Handle | |
1173 | HW.Part1 = nil | |
1174 | RAW.Part1 = nil | |
1175 | LAW.Part1 = nil | |
1176 | end | |
1177 | ||
1178 | function ReloadFunc(once) | |
1179 | if Ammunition.Ammo < Ammunition.MaxAmmo and Selected and not Reloading and not Attacking and Ammunition.Ammoleft > 0 then | |
1180 | if not once then | |
1181 | ReloadHold = true | |
1182 | end | |
1183 | ReloadStart(once) | |
1184 | end | |
1185 | end | |
1186 | ||
1187 | function onSelected(mouse) | |
1188 | SelectAnim() | |
1189 | mouse.Icon = Icon | |
1190 | Selected = true | |
1191 | Notime(function() | |
1192 | for _, g in pairs(AccuracyGuis) do | |
1193 | g.Gui.Transparency = 0.2 | |
1194 | end | |
1195 | while Selected do | |
1196 | pcall(function() | |
1197 | for _, g in pairs(AccuracyGuis) do | |
1198 | 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)) | |
1199 | end | |
1200 | end) | |
1201 | wait() | |
1202 | end | |
1203 | end) | |
1204 | mouse.Button1Down:connect(function() | |
1205 | if Selected and not Attacking and not Swinging then | |
1206 | if Reloading then | |
1207 | ReloadHold = false | |
1208 | else | |
1209 | if Ammunition.Ammo < 1 then | |
1210 | ReloadFunc(true) | |
1211 | else | |
1212 | ShootFunc((Pipe1.CFrame * CN(0, 0, 1.65)).p, mouse.Hit.p) | |
1213 | end | |
1214 | if Ammunition.Ammo < 1 and Ammunition.Ammoleft < 1 then | |
1215 | PlaySound(Sounds.Out) | |
1216 | end | |
1217 | end | |
1218 | end | |
1219 | end) | |
1220 | mouse.KeyDown:connect(function(key) | |
1221 | key = key:lower() | |
1222 | if Selected and not Attacking and not Swinging then | |
1223 | if key == "r" then | |
1224 | ReloadFunc() | |
1225 | elseif key == "e" then | |
1226 | Swing() | |
1227 | end | |
1228 | end | |
1229 | end) | |
1230 | mouse.KeyUp:connect(function(key) | |
1231 | key = key:lower() | |
1232 | if key == "r" then | |
1233 | ReloadHold = false | |
1234 | end | |
1235 | end) | |
1236 | end | |
1237 | ||
1238 | function onDeselected(mouse) | |
1239 | Selected = false | |
1240 | for _, g in pairs(AccuracyGuis) do | |
1241 | g.Gui.Transparency = 1 | |
1242 | end | |
1243 | DeselAnim() | |
1244 | end | |
1245 | ||
1246 | bin.Selected:connect(onSelected) | |
1247 | bin.Deselected:connect(onDeselected) |