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