SHOW:
|
|
- or go back to the newest paste.
1 | --Knife Module Script | |
2 | ||
3 | --Perhapz | |
4 | ||
5 | - | wait(.2) |
5 | + | |
6 | toool.Name = "QuickScope" | |
7 | ||
8 | local hndle = Instance.new("Part",toool) | |
9 | hndle.Name = "Handle" | |
10 | ||
11 | local mesh = Instance.new("SpecialMesh",hndle) | |
12 | mesh.MeshId = "http://www.roblox.com/asset/?id=121944778" | |
13 | mesh.TextureId = "http://www.roblox.com/asset/?id=121944805" | |
14 | mesh.Scale = Vector3.new(.7,.7,.7) | |
15 | ||
16 | local sound = Instance.new("Sound",hndle) | |
17 | ||
18 | ||
19 | script.Parent = toool | |
20 | ||
21 | ||
22 | ||
23 | ||
24 | local tool=script.Parent | |
25 | ||
26 | local player=game.Players.LocalPlayer | |
27 | ||
28 | local char=player.Character | |
29 | ||
30 | local humanoid=char:FindFirstChild("Humanoid") | |
31 | ||
32 | local camera=workspace.CurrentCamera | |
33 | ||
34 | local rightC1 = CFrame.new(-0.5, 0.7, 0) * CFrame.Angles(0, (math.pi / 2), 0) | |
35 | ||
36 | local leftC1 = CFrame.new(0, 0.7, 0) * CFrame.Angles(0, (math.pi / 2), 0) | |
37 | ||
38 | local mouse=player:GetMouse() | |
39 | ||
40 | local equipping=false | |
41 | ||
42 | local gettingknife=false | |
43 | ||
44 | local laserCharge=false | |
45 | ||
46 | local playcharge=false | |
47 | ||
48 | local justthrown=true | |
49 | - | local justthrown=false |
49 | + | |
50 | local canLaser=true | |
51 | ||
52 | local justattacked=false | |
53 | ||
54 | local thrownkniferotation=0 | |
55 | ||
56 | local Damage=999 | |
57 | - | local Damage=110 |
57 | + | |
58 | local Attacking=false | |
59 | ||
60 | local handle=nil | |
61 | ||
62 | local WalkSpeeds={500,100} | |
63 | - | local WalkSpeeds={16,20} |
63 | + | |
64 | local fasterthrow = 0 | |
65 | - | local fasterthrow = .2 |
65 | + | |
66 | local knifespeed = 225 | |
67 | ||
68 | ||
69 | ||
70 | ||
71 | ||
72 | ||
73 | ||
74 | --[[if player.Gamepass4.Value == true then | |
75 | ||
76 | fasterthrow = 0 | |
77 | - | fasterthrow = 0.5 |
77 | + | |
78 | else | |
79 | ||
80 | fasterthrow = 0 | |
81 | - | fasterthrow = 0.2 |
81 | + | |
82 | end | |
83 | ||
84 | if player.Gamepass5.Value == true then | |
85 | ||
86 | knifespeed = 305 | |
87 | ||
88 | else | |
89 | ||
90 | knifespeed = 225 | |
91 | ||
92 | end | |
93 | --]] | |
94 | ||
95 | ||
96 | ||
97 | ||
98 | ||
99 | SOUNDS={ | |
100 | ||
101 | throwing={"153647554","153647549"}, | |
102 | ||
103 | laserthrowing={"193444173"}, | |
104 | ||
105 | shouts={"241084057","224360245","199837759","168209314"}, | |
106 | ||
107 | striking={"153647529","153647534","153647539","153647540"}, | |
108 | ||
109 | equip="153647514", | |
110 | ||
111 | wallhit={"153647563","153647564"}, | |
112 | ||
113 | hitplayer={"153676325"}, | |
114 | ||
115 | deaths={"241084057","146457047","146594648","168209314"}, | |
116 | ||
117 | } | |
118 | ||
119 | ||
120 | ||
121 | SETTINGS={ | |
122 | ||
123 | ||
124 | tool={ | |
125 | ||
126 | tool_size=Vector3.new(0.4, 3, 0.7), | |
127 | ||
128 | tool_transparency=0, | |
129 | ||
130 | tool_color=BrickColor.Black(), | |
131 | ||
132 | default_tool_size=0.6, | |
133 | ||
134 | }, | |
135 | ||
136 | ||
137 | } | |
138 | ||
139 | ||
140 | ||
141 | function DamageObject(hit) | |
142 | ||
143 | local char=hit.Parent | |
144 | ||
145 | if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" then | |
146 | ||
147 | local h=char:FindFirstChild("Humanoid") | |
148 | ||
149 | if h and h.Health > 0 then | |
150 | ||
151 | ||
152 | ||
153 | h:TakeDamage(Damage) | |
154 | ||
155 | PlaySound("Hit1",char.Torso) | |
156 | ||
157 | local explosion = Instance.new("Explosion") | |
158 | ||
159 | explosion.ExplosionType = 'NoCraters' | |
160 | ||
161 | explosion.Position = humanoid.Torso.CFrame.p | |
162 | ||
163 | explosion.BlastPressure=0 | |
164 | ||
165 | explosion.Parent=workspace | |
166 | ||
167 | if h.Health == 0 then | |
168 | ||
169 | PlaySound("Hit2") | |
170 | ||
171 | end | |
172 | ||
173 | end | |
174 | ||
175 | end | |
176 | ||
177 | end | |
178 | ||
179 | ||
180 | ||
181 | function PlaySound(name,ctorso) | |
182 | ||
183 | if name=="Throw" then | |
184 | ||
185 | tool.Handle.Sound.SoundId = "rbxassetid://" .. SOUNDS.throwing[math.random(1,#SOUNDS.throwing)] | |
186 | ||
187 | tool.Handle.Sound:Play() | |
188 | ||
189 | elseif name=="ThrowLaser" then | |
190 | ||
191 | tool.Handle.Sound.SoundId = "rbxassetid://" .. SOUNDS.laserthrowing[math.random(1,#SOUNDS.laserthrowing)] | |
192 | ||
193 | tool.Handle.Sound:Play() | |
194 | ||
195 | elseif name=="Equip" then | |
196 | ||
197 | tool.Handle.Sound.SoundId = "rbxassetid://" .. SOUNDS.equip | |
198 | ||
199 | tool.Handle.Sound:Play() | |
200 | ||
201 | elseif name=="Swing" then | |
202 | ||
203 | tool.Handle.Sound.SoundId = "rbxassetid://" .. SOUNDS.striking[math.random(1,#SOUNDS.striking)] | |
204 | ||
205 | tool.Handle.Sound:Play() | |
206 | ||
207 | elseif name=="Hit1" then | |
208 | ||
209 | local NewSound=tool.Handle.Sound:clone() | |
210 | ||
211 | NewSound.Parent=ctorso | |
212 | ||
213 | NewSound.SoundId = "rbxassetid://" .. SOUNDS.hitplayer[math.random(1,#SOUNDS.hitplayer)] | |
214 | ||
215 | NewSound:Play() | |
216 | ||
217 | NewSound:Destroy() | |
218 | ||
219 | --elseif name=="Hit2" then | |
220 | ||
221 | --local NewSound=tool.Handle.Sound:clone() | |
222 | ||
223 | --NewSound.Parent=ctorso | |
224 | ||
225 | --NewSound.SoundId = "rbxassetid://" .. SOUNDS.deaths[math.random(1,#SOUNDS.deaths)] | |
226 | ||
227 | --NewSound:Play() | |
228 | ||
229 | -- NewSound:Destroy() | |
230 | ||
231 | elseif name=="Laser" then | |
232 | ||
233 | local NewSound=tool.Handle.Sound:Clone() | |
234 | ||
235 | NewSound.Parent = ctorso | |
236 | NewSound.SoundId = "rbxassetid://" .. SOUNDS.shouts[math.random(1,#SOUNDS.shouts)] | |
237 | ||
238 | NewSound:Play() | |
239 | ||
240 | ||
241 | end | |
242 | ||
243 | end | |
244 | ||
245 | ||
246 | ||
247 | function Throwtool(dPos) | |
248 | ||
249 | if not tool.Handle then return end | |
250 | ||
251 | local throwingHandle = tool.Handle:Clone() | |
252 | ||
253 | game:GetService("Debris"):AddItem(throwingHandle, 5) | |
254 | ||
255 | throwingHandle.Transparency=0 | |
256 | ||
257 | throwingHandle.Parent = workspace | |
258 | ||
259 | if player.Character and player.Character.Humanoid then | |
260 | ||
261 | throwingHandle.Velocity = (player.Character.Humanoid.TargetPoint - throwingHandle.CFrame.p).unit * knifespeed | |
262 | ||
263 | if canLaser then | |
264 | ||
265 | throwingHandle.Velocity = (player.Character.Humanoid.TargetPoint - throwingHandle.CFrame.p).unit * 15000 | |
266 | ||
267 | end | |
268 | ||
269 | if mouse.Target ~= nil then | |
270 | ||
271 | if mouse.Target.Parent.Name~="Arms_Model" and mouse.Target.Name~="ThrownKnife" and mouse.Target.Name~="Handle" then | |
272 | ||
273 | targetpos=player.Character.Humanoid.TargetPoint | |
274 | ||
275 | else | |
276 | ||
277 | targetpos=Vector3.new(0,-10,0) | |
278 | ||
279 | end | |
280 | ||
281 | end | |
282 | ||
283 | -- set the orientation to the direction it is being thrown in | |
284 | ||
285 | throwingHandle.CFrame = CFrame.new(throwingHandle.CFrame.p, throwingHandle.CFrame.p + throwingHandle.Velocity) * CFrame.Angles(0, 0, math.rad(-90)) | |
286 | ||
287 | local floatingForce = Instance.new('BodyForce', throwingHandle) | |
288 | ||
289 | floatingForce.force = Vector3.new(0, 196.2 * throwingHandle:GetMass() * 0.98, 0) | |
290 | ||
291 | local spin = Instance.new('BodyAngularVelocity', throwingHandle) | |
292 | ||
293 | spin.angularvelocity = throwingHandle.CFrame:vectorToWorldSpace(Vector3.new(0, -400, 0)) | |
294 | ||
295 | spawnPos=player.Character.PrimaryPart.Position | |
296 | ||
297 | spawnPos = spawnPos + dPos*5 | |
298 | ||
299 | if canLaser then | |
300 | ||
301 | local Ray = Ray.new(tool.Handle.CFrame.p,(mouse.Hit.p - tool.Handle.CFrame.p).unit * 999) | |
302 | ||
303 | local Hit,Position = game.Workspace:FindPartOnRay(Ray,char) | |
304 | ||
305 | if Hit then | |
306 | ||
307 | if Hit.Parent:FindFirstChild("Humanoid") then | |
308 | ||
309 | throwingHandle:Destroy() | |
310 | ||
311 | Hit.Parent.Humanoid:TakeDamage(110) | |
312 | PlaySound("Laser",Hit.Parent.Torso) | |
313 | PlaySound("Hit1",Hit.Parent.Torso) | |
314 | laserCharge=true | |
315 | ||
316 | ||
317 | ||
318 | local explosion = Instance.new("Explosion") | |
319 | ||
320 | explosion.Position=Hit.Parent.Torso.Position | |
321 | ||
322 | explosion.BlastRadius=explosion.BlastRadius*2 | |
323 | ||
324 | explosion.Parent=workspace | |
325 | ||
326 | end end | |
327 | ||
328 | local RayPart = Instance.new("Part",workspace) | |
329 | ||
330 | RayPart.Name = "RayPart" | |
331 | ||
332 | RayPart.BrickColor = BrickColor.new("White") | |
333 | ||
334 | RayPart.Transparency = 0 | |
335 | ||
336 | RayPart.Anchored = true | |
337 | ||
338 | RayPart.CanCollide = false | |
339 | ||
340 | RayPart.TopSurface = Enum.SurfaceType.Smooth | |
341 | ||
342 | RayPart.BottomSurface = Enum.SurfaceType.Smooth | |
343 | ||
344 | RayPart.formFactor = Enum.FormFactor.Custom | |
345 | ||
346 | local Distance = (Position-tool.Handle.CFrame.p).magnitude | |
347 | ||
348 | RayPart.Size = Vector3.new(0.2,0.2,Distance) | |
349 | ||
350 | RayPart.CFrame = CFrame.new(Position,tool.Handle.CFrame.p) * CFrame.new(0,0,-Distance/2) | |
351 | ||
352 | game.Debris:addItem(RayPart,.5) | |
353 | ||
354 | ||
355 | end | |
356 | ||
357 | end | |
358 | ||
359 | if throwingHandle then | |
360 | ||
361 | ||
362 | ||
363 | local touchedConn = throwingHandle.Touched:connect(function(hit) | |
364 | ||
365 | local char=hit.Parent | |
366 | ||
367 | camera.CameraSubject=humanoid | |
368 | ||
369 | camera.CameraType=Enum.CameraType.Custom | |
370 | ||
371 | if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" and hit.Name~="RayPart" then | |
372 | ||
373 | local h=char:FindFirstChild("Humanoid") | |
374 | ||
375 | if h and h.Health > 0 then | |
376 | ||
377 | throwingHandle:Destroy() | |
378 | ||
379 | laserCharge=true | |
380 | ||
381 | if hit.Name~="Head" or hit.className=="Hat" then | |
382 | ||
383 | h:TakeDamage(Damage) | |
384 | ||
385 | -- player.Credits.Value = player.Credits.Value + 15 | |
386 | ||
387 | --player.PlayerGui.NormalKillGui.Script.Disabled = false | |
388 | ||
389 | local explosion = Instance.new("Explosion") | |
390 | ||
391 | explosion.Position=h.Parent.Torso.Position | |
392 | ||
393 | explosion.BlastRadius=explosion.BlastRadius*2 | |
394 | ||
395 | explosion.Parent=workspace | |
396 | ||
397 | ||
398 | if h.Health == 0 then | |
399 | ||
400 | PlaySound("Hit2",char.Torso) | |
401 | ||
402 | end | |
403 | ||
404 | else | |
405 | ||
406 | h:TakeDamage(Damage * 2) | |
407 | ||
408 | print("Headshot!") | |
409 | ||
410 | --player.Credits.Value = player.Credits.Value + 50 | |
411 | ||
412 | --player.PlayerGui.HeadShotGui.Script.Disabled = false | |
413 | ||
414 | local explosion = Instance.new("Explosion") | |
415 | ||
416 | explosion.Position=h.Parent.Torso.Position | |
417 | ||
418 | explosion.BlastRadius=explosion.BlastRadius*2 | |
419 | ||
420 | explosion.Parent=workspace | |
421 | ||
422 | char.Head.Transparency=1 | |
423 | ||
424 | char.Head.CanCollide=false | |
425 | ||
426 | if char.Head:FindFirstChild("face") then char.Head:FindFirstChild("face").Transparency=1 end | |
427 | ||
428 | for _,v in pairs(char:GetChildren()) do | |
429 | ||
430 | if v.className=="Hat" then | |
431 | ||
432 | v:Destroy() | |
433 | ||
434 | end | |
435 | ||
436 | end | |
437 | ||
438 | for i = 1, 7 do | |
439 | ||
440 | local blood=Instance.new("Part") | |
441 | ||
442 | blood.FormFactor="Custom" | |
443 | ||
444 | blood.Size=Vector3.new(1,.2,1) | |
445 | ||
446 | blood.BrickColor=BrickColor.Red() | |
447 | ||
448 | blood.TopSurface=0 | |
449 | ||
450 | blood.BottomSurface=0 | |
451 | ||
452 | game:GetService("Debris"):AddItem(blood,5) | |
453 | ||
454 | blood.Parent=workspace | |
455 | ||
456 | blood.Position=char.Head.Position + Vector3.new(math.random(0.2,0.8),0,math.random(0.2,0.8)) | |
457 | ||
458 | end | |
459 | ||
460 | local sound = Instance.new("Sound") | |
461 | ||
462 | sound.SoundId = "rbxassetid://142347633" | |
463 | ||
464 | sound.Parent=char.Head | |
465 | ||
466 | sound.Pitch=1.1 | |
467 | ||
468 | sound:Play() | |
469 | ||
470 | end | |
471 | ||
472 | PlaySound("Hit1",char.Torso) | |
473 | ||
474 | if h.Health == 0 then | |
475 | ||
476 | PlaySound("Hit2") | |
477 | ||
478 | end | |
479 | ||
480 | elseif hit.Name~="Handle" or hit.Name~="IgnoreThrowingKnives" and hit.Parent.Name~="Arms_Model" and hit.Name~="RayPart" and hit.CanCollide==true then | |
481 | ||
482 | local sound=Instance.new("Sound") | |
483 | ||
484 | sound.Parent=hit | |
485 | ||
486 | sound.SoundId = "rbxassetid://" .. SOUNDS.wallhit[math.random(1,#SOUNDS.wallhit)] | |
487 | ||
488 | sound:Play() | |
489 | ||
490 | sound:Destroy() | |
491 | ||
492 | print("Hit Object: " .. hit.Name) | |
493 | ||
494 | local newknife=tool.Handle:clone() | |
495 | ||
496 | newknife.Name="ThrownKnife" | |
497 | ||
498 | newknife.CFrame = CFrame.new(spawnPos, spawnPos + dPos) * CFrame.Angles(math.pi/-2, 0, 0) | |
499 | ||
500 | newknife.Position = targetpos | |
501 | ||
502 | throwingHandle:Destroy() | |
503 | ||
504 | newknife.Anchored=true | |
505 | ||
506 | newknife.CanCollide=true | |
507 | ||
508 | newknife.Transparency=0 | |
509 | ||
510 | newknife.Parent=workspace | |
511 | ||
512 | --newknife.Script.Disabled = false | |
513 | ||
514 | wait(7) | |
515 | ||
516 | for i=1,10 do | |
517 | ||
518 | newknife.Transparency=i*.1 | |
519 | ||
520 | wait() | |
521 | ||
522 | end | |
523 | ||
524 | newknife:Destroy() | |
525 | ||
526 | end | |
527 | ||
528 | end | |
529 | ||
530 | end) | |
531 | ||
532 | end | |
533 | ||
534 | end | |
535 | ||
536 | -- must check if it still exists since we waited | |
537 | ||
538 | if throwingHandle then | |
539 | ||
540 | throwingHandle.CanCollide = true | |
541 | ||
542 | end | |
543 | ||
544 | ||
545 | ||
546 | FUNCTIONS={ | |
547 | ||
548 | ||
549 | CHECKFORFIRSTPERSON=function() | |
550 | ||
551 | if (camera.focus.p - camera.CoordinateFrame.p).magnitude > 1 then | |
552 | ||
553 | return false | |
554 | ||
555 | else | |
556 | ||
557 | return true | |
558 | ||
559 | end | |
560 | ||
561 | end, | |
562 | ||
563 | ||
564 | ANIMS=function(state) | |
565 | ||
566 | if state then | |
567 | ||
568 | mouse.Icon="http://www.roblox.com/asset/?id=258828417" | |
569 | ||
570 | --Start Animation | |
571 | ||
572 | ||
573 | ||
574 | if SETTINGS.tool then | |
575 | ||
576 | tool.GripPos = Vector3.new(0, -0.55, 0) | |
577 | ||
578 | elseif SETTINGS.tool then | |
579 | ||
580 | tool.GripPos = Vector3.new(0, -0.6, 0) | |
581 | ||
582 | elseif SETTINGS.tool then | |
583 | ||
584 | tool.GripPos = Vector3.new(0, -0.65, 0) | |
585 | ||
586 | elseif SETTINGS.tool then | |
587 | ||
588 | tool.GripPos = Vector3.new(0, -0.7, 0) | |
589 | ||
590 | elseif SETTINGS.tool then | |
591 | ||
592 | tool.GripPos = Vector3.new(0, -0.75, 0) | |
593 | ||
594 | elseif SETTINGS.tool then | |
595 | ||
596 | tool.GripPos = Vector3.new(0, -0.8, 0) | |
597 | ||
598 | elseif SETTINGS.tool then | |
599 | ||
600 | tool.GripPos = Vector3.new(0, -0.85, 0) | |
601 | ||
602 | elseif SETTINGS.tool then | |
603 | ||
604 | tool.GripPos = Vector3.new(0, -0.9, 0) | |
605 | ||
606 | elseif SETTINGS.tool then | |
607 | ||
608 | tool.GripPos = Vector3.new(0, -0.95, 0) | |
609 | ||
610 | elseif SETTINGS.tool then | |
611 | ||
612 | tool.GripPos = Vector3.new(0, -1, 0) | |
613 | ||
614 | else | |
615 | ||
616 | print("Invalid tool size! Set to default: " .. SETTINGS.tool.default_tool_size ) | |
617 | ||
618 | ||
619 | if SETTINGS.tool.default_tool_size==.1 then | |
620 | ||
621 | tool.GripPos = Vector3.new(0, -0.55, 0) | |
622 | ||
623 | elseif SETTINGS.tool.default_tool_size==.2 then | |
624 | ||
625 | tool.GripPos = Vector3.new(0, -0.6, 0) | |
626 | ||
627 | elseif SETTINGS.tool.default_tool_size==.3 then | |
628 | ||
629 | tool.GripPos = Vector3.new(0, -0.65, 0) | |
630 | ||
631 | elseif SETTINGS.tool.default_tool_size==.4 then | |
632 | ||
633 | tool.GripPos = Vector3.new(0, -0.7, 0) | |
634 | ||
635 | elseif SETTINGS.tool.default_tool_size==.5 then | |
636 | ||
637 | tool.GripPos = Vector3.new(0, -0.75, 0) | |
638 | ||
639 | elseif SETTINGS.tool.default_tool_size==.6 then | |
640 | ||
641 | tool.GripPos = Vector3.new(0, -0.8, 0) | |
642 | ||
643 | elseif SETTINGS.tool.default_tool_size==.7 then | |
644 | ||
645 | tool.GripPos = Vector3.new(0, -0.85, 0) | |
646 | ||
647 | elseif SETTINGS.tool.default_tool_size==.8 then | |
648 | ||
649 | tool.GripPos = Vector3.new(0, -0.9, 0) | |
650 | ||
651 | elseif SETTINGS.tool.default_tool_size==.9 then | |
652 | ||
653 | tool.GripPos = Vector3.new(0, -0.95, 0) | |
654 | ||
655 | elseif SETTINGS.tool.default_tool_size==1 then | |
656 | ||
657 | tool.GripPos = Vector3.new(0, -1, 0) | |
658 | ||
659 | else | |
660 | ||
661 | print("Invalid default size! Un-equipping and removing Knife...") | |
662 | ||
663 | ||
664 | end | |
665 | ||
666 | end | |
667 | ||
668 | torso=char:FindFirstChild("Torso") | |
669 | ||
670 | leftarm=torso:FindFirstChild("Left Shoulder") | |
671 | ||
672 | if leftarm then | |
673 | ||
674 | leftarm.Parent=nil | |
675 | ||
676 | newarmweld=Instance.new("Weld") | |
677 | ||
678 | newarmweld.Name="LeftWeld" | |
679 | ||
680 | newarmweld.Part0=torso | |
681 | ||
682 | newarmweld.C0 = CFrame.new(-1.5, 0.7, 0) | |
683 | ||
684 | newarmweld.C1 = CFrame.new(0, 0.7, 0) | |
685 | ||
686 | newarmweld.Part1=char:FindFirstChild("Left Arm") | |
687 | ||
688 | newarmweld.Parent=torso | |
689 | ||
690 | end | |
691 | ||
692 | humanoid.WalkSpeed=WalkSpeeds[2] | |
693 | ||
694 | for i = 1, 15, 3 do | |
695 | ||
696 | if equipped then | |
697 | ||
698 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.Angles((-i * (math.pi / 90)),(-i * (math.pi / 90)),(i * (math.pi / 210))) | |
699 | ||
700 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0) * CFrame.Angles((-i * (math.pi / 60)),(i * (math.pi / 90)),(-i * (math.pi / 240))) | |
701 | ||
702 | end | |
703 | ||
704 | wait() | |
705 | ||
706 | end | |
707 | ||
708 | else | |
709 | ||
710 | humanoid.WalkSpeed=WalkSpeeds[1] | |
711 | ||
712 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.new(0,-0.2,0) | |
713 | ||
714 | tool.GripForward = Vector3.new(0,0,-1) | |
715 | ||
716 | newarmweld:Destroy() | |
717 | ||
718 | leftarm.Parent=torso | |
719 | ||
720 | mouse.Icon="" | |
721 | ||
722 | torso:FindFirstChild("Neck").C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
723 | ||
724 | torso:FindFirstChild("Right Shoulder").C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
725 | ||
726 | end | |
727 | ||
728 | end | |
729 | ||
730 | } | |
731 | ||
732 | ||
733 | ||
734 | tool.Equipped:connect(function () | |
735 | ||
736 | equipped=true | |
737 | ||
738 | PlaySound("Equip") | |
739 | ||
740 | FUNCTIONS.ANIMS(true) | |
741 | ||
742 | end) | |
743 | ||
744 | tool.Unequipped:connect(function () | |
745 | ||
746 | equipped=false | |
747 | ||
748 | FUNCTIONS.ANIMS(false) | |
749 | ||
750 | end) | |
751 | ||
752 | tool.Handle.Touched:connect(function (hit) | |
753 | ||
754 | if Attacking then | |
755 | ||
756 | DamageObject(hit) | |
757 | ||
758 | end | |
759 | ||
760 | end) | |
761 | ||
762 | tool.Activated:connect(function () | |
763 | ||
764 | if Attacking then return end | |
765 | ||
766 | if not tool.Enabled then return end | |
767 | ||
768 | justthrown=false | |
769 | ||
770 | justattacked=false | |
771 | ||
772 | if not gettingknife and not justthrown and not Attacking then | |
773 | ||
774 | HeldTime=time() | |
775 | ||
776 | end | |
777 | ||
778 | playcharge=true | |
779 | ||
780 | wait(.15) | |
781 | ||
782 | while gettingknife do | |
783 | ||
784 | wait() | |
785 | ||
786 | end | |
787 | ||
788 | local speed=0.2 | |
789 | ||
790 | for i = 1, 15, fasterthrow do | |
791 | ||
792 | if playcharge and equipped and not gettingknife and not justthrown and not Attacking then | |
793 | ||
794 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.5, 0.5, 0, 0.195277825, -0.747909963, 0.634426773, 0.482016951, 0.636551082, 0.602048457, -0.854123056, 0.188237742, 0.484809577) * CFrame.Angles((i * (math.pi / 50)), 0, (-i * (math.pi / 25))) | |
795 | ||
796 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0, 0.858912528, 0.165011853, 0.484809607, -0.464581847, 0.649385393, 0.602048457, -0.215483144, -0.742340684, 0.634426773) * CFrame.Angles((-i * (math.pi / 75)),(i * (math.pi / 180)),0) | |
797 | ||
798 | player.Character["Right Arm"].RightGrip.C1 = CFrame.new(0, -0.800000012, 0.05, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.Angles((-i * (math.pi / 150)),0,0) | |
799 | ||
800 | wait() | |
801 | ||
802 | end | |
803 | ||
804 | end | |
805 | ||
806 | if playcharge then | |
807 | ||
808 | canLaser=true | |
809 | ||
810 | end | |
811 | ||
812 | end) | |
813 | ||
814 | tool.Deactivated:connect(function () | |
815 | ||
816 | if not tool.Enabled then return end | |
817 | ||
818 | currTime=time() | |
819 | ||
820 | playcharge=false | |
821 | ||
822 | if HeldTime and currTime - HeldTime > .6 and | |
823 | ||
824 | currTime - HeldTime > 0.01 and not justthrown and not gettingknife then | |
825 | ||
826 | if not Attacking and not justattacked then | |
827 | ||
828 | print("Throw") | |
829 | ||
830 | if canLaser then | |
831 | ||
832 | PlaySound("ThrowLaser") | |
833 | ||
834 | else | |
835 | ||
836 | PlaySound("Throw") | |
837 | ||
838 | end | |
839 | ||
840 | tool.Handle.Transparency=1 | |
841 | ||
842 | local targetPos = player.Character.Humanoid.TargetPoint | |
843 | ||
844 | local lookAt = (targetPos - player.Character.PrimaryPart.Position).unit | |
845 | ||
846 | local switchEvenOddParity = 1 | |
847 | ||
848 | local angle = math.ceil((1-1)/2)*math.pi/12*switchEvenOddParity | |
849 | ||
850 | Throwtool(CFrame.Angles(0, angle, 0) * lookAt) | |
851 | ||
852 | wait() | |
853 | canLaser=true | |
854 | ||
855 | HeldTime=0 | |
856 | ||
857 | gettingknife=true | |
858 | ||
859 | mouse.Icon="http://www.roblox.com/asset/?id=258828417" | |
860 | ||
861 | player.Character["Right Arm"].RightGrip.C1 = CFrame.new(0, -0.800000012, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
862 | ||
863 | for i = 1, 15, .8 do | |
864 | ||
865 | if equipped then | |
866 | ||
867 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.5, 0.5, 0, 0.0719629526, 0.22870943, 0.970831275, -0.981789052, 0.187819958, 0.0285283029, -0.175816804, -0.955204487, 0.238060504) * CFrame.Angles(0, 0, (i * (math.pi / 15))) | |
868 | ||
869 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, 0.7, 0, 0.703028679, -0.151466534, 0.694844246, -0.673604906, 0.171488613, 0.718921423, -0.228050426, -0.973472893, 0.0185328126) * CFrame.Angles((i * (math.pi / 60)),(-i * (math.pi / 180)),(i * (math.pi / 60))) | |
870 | ||
871 | wait() | |
872 | ||
873 | end | |
874 | ||
875 | end | |
876 | ||
877 | justthrown=true | |
878 | ||
879 | tool.Handle.Transparency=0 | |
880 | ||
881 | PlaySound("Equip") | |
882 | ||
883 | mouse.Icon="http://www.roblox.com/asset/?id=258828417" | |
884 | ||
885 | tool.GripForward = Vector3.new(0,0,-1) | |
886 | ||
887 | for i = 1, 15, 1 do | |
888 | ||
889 | if equipped then | |
890 | ||
891 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.5, 0.5, 0, -0.071962975, -0.22870943, 0.970831275, 0.981789052, -0.187820047, 0.0285283029, 0.175816894, 0.955204487, 0.238060504) * CFrame.Angles(0, 0, (-i * (math.pi / 30))) | |
892 | ||
893 | wait() | |
894 | ||
895 | end | |
896 | ||
897 | end | |
898 | ||
899 | gettingknife=false | |
900 | ||
901 | for i = 1, 15, 3 do | |
902 | ||
903 | if equipped then | |
904 | ||
905 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.Angles((-i * (math.pi / 90)),(-i * (math.pi / 90)),(i * (math.pi / 210))) | |
906 | ||
907 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0) * CFrame.Angles((-i * (math.pi / 60)),(i * (math.pi / 90)),(-i * (math.pi / 240))) | |
908 | ||
909 | end | |
910 | ||
911 | wait() | |
912 | ||
913 | end | |
914 | ||
915 | end | |
916 | ||
917 | else | |
918 | ||
919 | if not justthrown and not gettingknife then | |
920 | ||
921 | if Attacking then return end | |
922 | ||
923 | print("Attack") | |
924 | ||
925 | HeldTime=0 | |
926 | ||
927 | Attacking=true | |
928 | ||
929 | justattacked=true | |
930 | ||
931 | if math.random(1,2)==1 then | |
932 | ||
933 | for i = 1, 15, 3 do | |
934 | ||
935 | if equipped and not gettingknife and not justthrown then | |
936 | ||
937 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.5, 0.5, 0, 0.195277825, -0.747909963, 0.634426773, 0.482016951, 0.636551082, 0.602048457, -0.854123056, 0.188237742, 0.484809577) * CFrame.Angles((i * (math.pi / 65)), 0, (-i * (math.pi / 30))) | |
938 | ||
939 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0, 0.858912528, 0.165011853, 0.484809607, -0.464581847, 0.649385393, 0.602048457, -0.215483144, -0.742340684, 0.634426773) * CFrame.Angles((-i * (math.pi / 75)),(i * (math.pi / 180)),0) | |
940 | ||
941 | wait() | |
942 | ||
943 | end | |
944 | ||
945 | end | |
946 | ||
947 | PlaySound("Swing") | |
948 | ||
949 | for i = 1, 15, 3 do | |
950 | ||
951 | if equipped and not gettingknife and not justthrown then | |
952 | ||
953 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.5, 0.5, 0, 0.0719629526, 0.22870943, 0.970831275, -0.981789052, 0.187819958, 0.0285283029, -0.175816804, -0.955204487, 0.238060504) * CFrame.Angles(0, 0, (i * (math.pi / 15))) | |
954 | ||
955 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, 0.7, 0, 0.703028679, -0.151466534, 0.694844246, -0.673604906, 0.171488613, 0.718921423, -0.228050426, -0.973472893, 0.0185328126) * CFrame.Angles((i * (math.pi / 60)),(-i * (math.pi / 180)),(i * (math.pi / 60))) | |
956 | ||
957 | wait() | |
958 | ||
959 | end | |
960 | ||
961 | end | |
962 | ||
963 | for i = 1, 15, 3 do | |
964 | ||
965 | if equipped and not justthrown and not gettingknife then | |
966 | ||
967 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.5, 0.5, 0, -0.071962975, -0.22870943, 0.970831275, 0.981789052, -0.187820047, 0.0285283029, 0.175816894, 0.955204487, 0.238060504) * CFrame.Angles(0, 0, (-i * (math.pi / 30))) | |
968 | ||
969 | wait() | |
970 | ||
971 | end | |
972 | ||
973 | end | |
974 | ||
975 | for i = 1, 15, 3 do | |
976 | ||
977 | equipping=true | |
978 | ||
979 | if equipped and not gettingknife and not justthrown then | |
980 | ||
981 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.Angles((-i * (math.pi / 90)),(-i * (math.pi / 90)),(i * (math.pi / 210))) | |
982 | ||
983 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0) * CFrame.Angles((-i * (math.pi / 60)),(i * (math.pi / 90)),(-i * (math.pi / 240))) | |
984 | ||
985 | end | |
986 | ||
987 | wait() | |
988 | ||
989 | end | |
990 | ||
991 | Attacking=false | |
992 | ||
993 | else | |
994 | ||
995 | for i = 1, 15, 3 do | |
996 | ||
997 | if equipped and not gettingknife and not justthrown then | |
998 | ||
999 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.3, 0.5, 0, 0.195277825, -0.747909963, 0.634426773, 0.482016951, 0.636551082, 0.602048457, -0.854123056, 0.188237742, 0.484809577) * CFrame.Angles((i * (math.pi / 40)),(-i * (math.pi / 45)),(i * (math.pi / 60))) | |
1000 | ||
1001 | end | |
1002 | ||
1003 | wait() | |
1004 | ||
1005 | end | |
1006 | ||
1007 | PlaySound("Swing") | |
1008 | ||
1009 | for i = 1, 15, 3 do | |
1010 | ||
1011 | if equipped and not gettingknife and not justthrown then | |
1012 | ||
1013 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.2, 0.5, -.3, 0.852928281, -0.428775758, 0.29776603, 0.516928136, 0.614185035, -0.596290231, 0.0727913082, 0.662516415, 0.745502114) * CFrame.Angles((-i * (math.pi / 45)),0,0) | |
1014 | ||
1015 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.200000003, 0.7, 0, 0.849384904, 0.16895318, 0.5, -0.48470962, 0.624545038, 0.612372398, -0.208810255, -0.762494743, 0.612372398) * CFrame.Angles((i * (math.pi / 60)),(-i * (math.pi / 180)),(i * (math.pi / 60))) | |
1016 | ||
1017 | end | |
1018 | ||
1019 | wait() | |
1020 | ||
1021 | end | |
1022 | ||
1023 | for i = 1, 15, 3 do | |
1024 | ||
1025 | if equipped and not gettingknife and not justthrown then | |
1026 | ||
1027 | torso:FindFirstChild("Right Shoulder").C1 = CFrame.new(-0.3, 0.5, -0.300000012, 0.852928281, -0.472260833, -0.222447708, 0.516928136, 0.82349503, 0.233754784, 0.0727913082, -0.314365625, 0.946507096) * CFrame.Angles((i * (math.pi / 45)),0,0) | |
1028 | ||
1029 | end | |
1030 | ||
1031 | wait() | |
1032 | ||
1033 | end | |
1034 | ||
1035 | for i = 1, 15, 3 do | |
1036 | ||
1037 | if equipped and not gettingknife and not justthrown then | |
1038 | ||
1039 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.Angles((-i * (math.pi / 90)),(-i * (math.pi / 90)),(i * (math.pi / 210))) | |
1040 | ||
1041 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0) * CFrame.Angles((-i * (math.pi / 60)),(i * (math.pi / 90)),(-i * (math.pi / 240))) | |
1042 | ||
1043 | end | |
1044 | ||
1045 | wait() | |
1046 | ||
1047 | end | |
1048 | ||
1049 | Attacking=false | |
1050 | ||
1051 | end | |
1052 | ||
1053 | end | |
1054 | ||
1055 | end | |
1056 | ||
1057 | end) | |
1058 | ||
1059 | ||
1060 | ||
1061 | mouse.Move:connect(function () | |
1062 | ||
1063 | if equipped and mouse then | |
1064 | ||
1065 | if (mouse.Hit.p - mouse.Origin.p).unit.y < 0.25 and (mouse.Hit.p - mouse.Origin.p).unit.y > -0.25 then | |
1066 | ||
1067 | torso:FindFirstChild("Right Shoulder").C0 = CFrame.new(.9,.5,0) * CFrame.Angles(0,math.rad(90),0) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y)) | |
1068 | ||
1069 | torso:FindFirstChild("LeftWeld").C0 = CFrame.new(-1.5,0.5,0) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y)) | |
1070 | ||
1071 | torso:FindFirstChild("Neck").C0 = CFrame.new(0,1,0) * CFrame.Angles(math.rad(-90),0,math.rad(180)) * CFrame.Angles(math.asin(-(mouse.Hit.p - mouse.Origin.p).unit.y), 0, 0) | |
1072 | ||
1073 | end | |
1074 | ||
1075 | end | |
1076 | ||
1077 | end) |