SHOW:
|
|
- or go back to the newest paste.
1 | --Knife Module Script | |
2 | --Perhapz | |
3 | wait(.2) | |
4 | ||
5 | local toool = Instance.new("Tool",game.Players.LocalPlayer.Backpack) | |
6 | toool.Name = "FreezeKnife" | |
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 | ||
15 | ||
16 | local sund = Instance.new("Sound",hndle) | |
17 | ||
18 | script.Parent = toool | |
19 | ||
20 | ||
21 | ||
22 | ||
23 | local tool=script.Parent | |
24 | local player=game.Players.LocalPlayer | |
25 | local char=player.Character | |
26 | local humanoid=char:FindFirstChild("Humanoid") | |
27 | local camera=workspace.CurrentCamera | |
28 | local rightC1 = CFrame.new(-0.5, 0.7, 0) * CFrame.Angles(0, (math.pi / 2), 0) | |
29 | local leftC1 = CFrame.new(0, 0.7, 0) * CFrame.Angles(0, (math.pi / 2), 0) | |
30 | local mouse=player:GetMouse() | |
31 | local equipping=false | |
32 | local gettingknife=false | |
33 | local playcharge=false | |
34 | local justthrown=false | |
35 | local justattacked=false | |
36 | local thrownkniferotation=0 | |
37 | local Damage=110 | |
38 | local Attacking=false | |
39 | local handle=nil | |
40 | local WalkSpeeds={16,20} | |
41 | local fasterthrow = 0.2 | |
42 | local knifespeed = 225 | |
43 | ||
44 | if player.Name == "Perhapz" then | |
45 | fasterthrow = 0.5 | |
46 | else | |
47 | fasterthrow = 0.2 | |
48 | end | |
49 | ||
50 | --[[if player.Gamepass4.Value == true then | |
51 | fasterthrow = 0.5 | |
52 | else | |
53 | fasterthrow = 0.2 | |
54 | end | |
55 | if player.Gamepass5.Value == true then | |
56 | knifespeed = 305 | |
57 | else | |
58 | knifespeed = 225 | |
59 | end | |
60 | --]] | |
61 | ||
62 | SOUNDS={ | |
63 | throwing={"153647554","153647549"}, | |
64 | striking={"153647529","153647534","153647539","153647540"}, | |
65 | equip="153647514", | |
66 | wallhit={"153647563","153647564"}, | |
67 | hitplayer={"153647516","153647519","153647522","153647526"}, | |
68 | deaths={"176399994"}, | |
69 | } | |
70 | ||
71 | SETTINGS={ | |
72 | ||
73 | tool={ | |
74 | tool_size=Vector3.new(0.4, 3, 0.7), | |
75 | tool_transparency=0, | |
76 | tool_color=BrickColor.Black(), | |
77 | default_tool_size=0.6, | |
78 | }, | |
79 | ||
80 | } | |
81 | ||
82 | ||
83 | --[[function onHumanoidDied(humanoid, player) | |
84 | local killer = getKillerOfHumanoidIfStillInGame(humanoid) | |
85 | --if killer.Name == "Perhapz" then | |
86 | --script.Parent.Handle.Badge.Disabled = false | |
87 | ||
88 | --end | |
89 | HandleKillCount(humanoid, player) | |
90 | end | |
91 | function HandleKillCount(humanoid, player) | |
92 | local Killer = getKillerOfHumanoidIfStillInGame(humanoid) | |
93 | if Killer then | |
94 | if Killer ~= player then | |
95 | if player.Name == "Perhapz" then | |
96 | script.Parent.Handle.Badge1.Disabled = false | |
97 | end | |
98 | end | |
99 | end | |
100 | end | |
101 | --]] | |
102 | ||
103 | --[[function getKillerOfHumanoidIfStillInGame(humanoid) | |
104 | -- returns the player object that killed this humanoid | |
105 | -- returns nil if the killer is no longer in the game | |
106 | ||
107 | -- check for kill tag on humanoid - may be more than one - todo: deal with this | |
108 | local tag = humanoid:findFirstChild("creator") | |
109 | ||
110 | -- find player with name on tag | |
111 | if tag ~= nil then | |
112 | ||
113 | local killer = tag.Value | |
114 | if killer.Parent ~= nil then -- killer still in game | |
115 | return killer | |
116 | end | |
117 | end | |
118 | ||
119 | return nil | |
120 | end | |
121 | ||
122 | --]] | |
123 | ||
124 | function DamageObject(hit) | |
125 | local char=hit.Parent | |
126 | if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" then | |
127 | local h=char:FindFirstChild("Humanoid") | |
128 | if h and h.Health > 0 then | |
129 | local tag = Instance.new("ObjectValue") | |
130 | tag.Name = "creator" | |
131 | tag.Value = player | |
132 | game:GetService("Debris"):AddItem(tag, 3) | |
133 | tag.Parent = humanoid | |
134 | ||
135 | ||
136 | if hit.Parent:FindFirstChild("QuickScope") then | |
137 | hit.Parent.QuickScope:remove() | |
138 | end | |
139 | if hit.Parent:FindFirstChild("BoomBlade") then | |
140 | hit.Parent.BoomBlade:remove() | |
141 | end | |
142 | if hit.Parent:FindFirstChild("FireKnife") then | |
143 | hit.Parent.FireKnife:remove() | |
144 | end | |
145 | if hit.Parent:FindFirstChild("Knife") then | |
146 | hit.Parent.Knife:remove() | |
147 | end | |
148 | if hit.Parent:FindFirstChild("LaserKnife") then | |
149 | hit.Parent.LaserKnife:remove() | |
150 | end | |
151 | if hit.Parent:FindFirstChild("FreezeKnife") then | |
152 | hit.Parent.FreezeKnife:remove() | |
153 | end | |
154 | ||
155 | hit.Parent.Head.Anchored = true | |
156 | hit.Parent.Torso.Anchored = true | |
157 | hit.Parent:WaitForChild("Left Arm").Anchored = true | |
158 | hit.Parent:WaitForChild("Right Arm").Anchored = true | |
159 | hit.Parent:WaitForChild("Left Leg").Anchored = true | |
160 | hit.Parent:WaitForChild("Right Leg").Anchored = true | |
161 | local freezepart = Instance.new("Part",hit.Parent) | |
162 | freezepart.Name = "FreezePart" | |
163 | freezepart.BrickColor = BrickColor.new("Teal") | |
164 | freezepart.Size = Vector3.new(9,8,6) | |
165 | freezepart.Transparency = 0.6 | |
166 | freezepart.Anchored = true | |
167 | freezepart.CanCollide = false | |
168 | ||
169 | freezepart.Position = hit.Parent.Torso.Position | |
170 | freezepart.CanCollide = true | |
171 | PlaySound("Hit1",char.Torso) | |
172 | ||
173 | PlaySound("Hit2",char.Torso) | |
174 | while true do | |
175 | hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 3 | |
176 | wait(.1) | |
177 | end | |
178 | ||
179 | ||
180 | end | |
181 | end | |
182 | end | |
183 | ||
184 | function PlaySound(name,ctorso) | |
185 | if name=="Throw" then | |
186 | tool.Handle.Sound.SoundId = "rbxassetid://" .. SOUNDS.throwing[math.random(1,#SOUNDS.throwing)] | |
187 | tool.Handle.Sound:Play() | |
188 | elseif name=="Equip" then | |
189 | tool.Handle.Sound.SoundId = "rbxassetid://" .. SOUNDS.equip | |
190 | tool.Handle.Sound:Play() | |
191 | elseif name=="Swing" then | |
192 | tool.Handle.Sound.SoundId = "rbxassetid://" .. SOUNDS.striking[math.random(1,#SOUNDS.striking)] | |
193 | tool.Handle.Sound:Play() | |
194 | elseif name=="Hit1" then | |
195 | local NewSound=tool.Handle.Sound:clone() | |
196 | NewSound.Parent=ctorso | |
197 | NewSound.SoundId = "rbxassetid://" .. SOUNDS.hitplayer[math.random(1,#SOUNDS.hitplayer)] | |
198 | NewSound:Play() | |
199 | NewSound:Destroy() | |
200 | elseif name=="Hit2" then | |
201 | local NewSound=tool.Handle.Sound:clone() | |
202 | NewSound.Parent=ctorso | |
203 | NewSound.SoundId = "rbxassetid://" .. SOUNDS.deaths[math.random(1,#SOUNDS.deaths)] | |
204 | NewSound:Play() | |
205 | NewSound:Destroy() | |
206 | end | |
207 | end | |
208 | ||
209 | function ThrowTool(dPos) | |
210 | if not tool.Handle then return end | |
211 | local throwingHandle = tool.Handle:Clone() | |
212 | game:GetService("Debris"):AddItem(throwingHandle, 5) | |
213 | throwingHandle.Transparency=0 | |
214 | throwingHandle.Parent = workspace | |
215 | if player.Character and player.Character.Humanoid then | |
216 | throwingHandle.Velocity = (player.Character.Humanoid.TargetPoint - throwingHandle.CFrame.p).unit * knifespeed | |
217 | if mouse.Target ~= nil then | |
218 | if mouse.Target.Parent.Name~="Arms_Model" and mouse.Target.Name~="ThrownKnife" and mouse.Target.Name~="Handle" then | |
219 | targetpos=player.Character.Humanoid.TargetPoint | |
220 | else | |
221 | targetpos=Vector3.new(0,-10,0) | |
222 | end | |
223 | end | |
224 | -- set the orientation to the direction it is being thrown in | |
225 | throwingHandle.CFrame = CFrame.new(throwingHandle.CFrame.p, throwingHandle.CFrame.p + throwingHandle.Velocity) * CFrame.Angles(0, 0, math.rad(-90)) | |
226 | local floatingForce = Instance.new('BodyForce', throwingHandle) | |
227 | floatingForce.force = Vector3.new(0, 196.2 * throwingHandle:GetMass() * 0.98, 0) | |
228 | local spin = Instance.new('BodyAngularVelocity', throwingHandle) | |
229 | spin.angularvelocity = throwingHandle.CFrame:vectorToWorldSpace(Vector3.new(0, -500, 0)) | |
230 | spawnPos=player.Character.PrimaryPart.Position | |
231 | spawnPos = spawnPos + dPos*5 | |
232 | end | |
233 | if throwingHandle then | |
234 | --throwingHandle.Badge.Disabled = false | |
235 | --throwingHandle.Badge1.Disabled = false | |
236 | ||
237 | local touchedConn = throwingHandle.Touched:connect(function(hit) | |
238 | local char=hit.Parent | |
239 | camera.CameraSubject=humanoid | |
240 | camera.CameraType=Enum.CameraType.Custom | |
241 | if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" then | |
242 | local h=char:FindFirstChild("Humanoid") | |
243 | if h and h.Health > 0 then | |
244 | throwingHandle:Destroy() | |
245 | if hit.Name~="Head" or hit.className=="Hat" then | |
246 | ||
247 | -- player.Credits.Value = player.Credits.Value + 15 | |
248 | --player.PlayerGui.NormalKillGui.Script.Disabled = false | |
249 | ||
250 | if hit.Parent:FindFirstChild("QuickScope") then | |
251 | hit.Parent.QuickScope:remove() | |
252 | end | |
253 | if hit.Parent:FindFirstChild("BoomBlade") then | |
254 | hit.Parent.BoomBlade:remove() | |
255 | end | |
256 | if hit.Parent:FindFirstChild("FireKnife") then | |
257 | hit.Parent.FireKnife:remove() | |
258 | end | |
259 | if hit.Parent:FindFirstChild("Knife") then | |
260 | hit.Parent.Knife:remove() | |
261 | end | |
262 | if hit.Parent:FindFirstChild("LaserKnife") then | |
263 | hit.Parent.LaserKnife:remove() | |
264 | end | |
265 | if hit.Parent:FindFirstChild("FreezeKnife") then | |
266 | hit.Parent.FreezeKnife:remove() | |
267 | end | |
268 | ||
269 | ||
270 | hit.Parent.Head.Anchored = true | |
271 | hit.Parent.Torso.Anchored = true | |
272 | hit.Parent:WaitForChild("Left Arm").Anchored = true | |
273 | hit.Parent:WaitForChild("Right Arm").Anchored = true | |
274 | hit.Parent:WaitForChild("Left Leg").Anchored = true | |
275 | hit.Parent:WaitForChild("Right Leg").Anchored = true | |
276 | local freezepart = Instance.new("Part",hit.Parent) | |
277 | freezepart.Name = "FreezePart" | |
278 | freezepart.BrickColor = BrickColor.new("Teal") | |
279 | freezepart.Size = Vector3.new(9,8,6) | |
280 | freezepart.Transparency = 0.6 | |
281 | freezepart.Anchored = true | |
282 | freezepart.CanCollide = false | |
283 | ||
284 | freezepart.Position = hit.Parent.Torso.Position | |
285 | freezepart.CanCollide = true | |
286 | ||
287 | PlaySound("Hit1",char.Torso) | |
288 | ||
289 | PlaySound("Hit2",char.Torso) | |
290 | while true do | |
291 | hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 3 | |
292 | ||
293 | wait(.1) | |
294 | end | |
295 | ||
296 | else | |
297 | ||
298 | print("Headshot!") | |
299 | --player.Credits.Value = player.Credits.Value + 50 | |
300 | --player.PlayerGui.HeadShotGui.Script.Disabled = false | |
301 | ||
302 | if hit.Parent:FindFirstChild("QuickScope") then | |
303 | hit.Parent.QuickScope:remove() | |
304 | end | |
305 | if hit.Parent:FindFirstChild("BoomBlade") then | |
306 | hit.Parent.BoomBlade:remove() | |
307 | end | |
308 | if hit.Parent:FindFirstChild("FireKnife") then | |
309 | hit.Parent.FireKnife:remove() | |
310 | end | |
311 | if hit.Parent:FindFirstChild("Knife") then | |
312 | hit.Parent.Knife:remove() | |
313 | end | |
314 | if hit.Parent:FindFirstChild("LaserKnife") then | |
315 | hit.Parent.LaserKnife:remove() | |
316 | end | |
317 | if hit.Parent:FindFirstChild("FreezeKnife") then | |
318 | hit.Parent.FreezeKnife:remove() | |
319 | end | |
320 | ||
321 | ||
322 | hit.Parent.Head.Anchored = true | |
323 | hit.Parent.Torso.Anchored = true | |
324 | hit.Parent:WaitForChild("Left Arm").Anchored = true | |
325 | hit.Parent:WaitForChild("Right Arm").Anchored = true | |
326 | hit.Parent:WaitForChild("Left Leg").Anchored = true | |
327 | hit.Parent:WaitForChild("Right Leg").Anchored = true | |
328 | local freezepart = Instance.new("Part",hit.Parent) | |
329 | freezepart.Name = "FreezePart" | |
330 | freezepart.BrickColor = BrickColor.new("Teal") | |
331 | freezepart.Size = Vector3.new(9,8,6) | |
332 | freezepart.Transparency = 0.6 | |
333 | freezepart.Anchored = true | |
334 | freezepart.CanCollide = false | |
335 | ||
336 | freezepart.Position = hit.Parent.Torso.Position | |
337 | freezepart.CanCollide = true | |
338 | ||
339 | char.Head.Transparency=1 | |
340 | char.Head.CanCollide=false | |
341 | if char.Head:FindFirstChild("face") then char.Head:FindFirstChild("face").Transparency=1 end | |
342 | for _,v in pairs(char:GetChildren()) do | |
343 | if v.className=="Hat" then | |
344 | v:Destroy() | |
345 | end | |
346 | end | |
347 | for i = 1, 7 do | |
348 | local blood=Instance.new("Part") | |
349 | blood.FormFactor="Custom" | |
350 | blood.Size=Vector3.new(1,.2,1) | |
351 | blood.BrickColor=BrickColor.Red() | |
352 | blood.TopSurface=0 | |
353 | blood.BottomSurface=0 | |
354 | game:GetService("Debris"):AddItem(blood,5) | |
355 | blood.Parent=workspace | |
356 | blood.Position=char.Head.Position + Vector3.new(math.random(0.2,0.8),0,math.random(0.2,0.8)) | |
357 | end | |
358 | end | |
359 | PlaySound("Hit1") | |
360 | ||
361 | PlaySound("Hit2") | |
362 | while true do | |
363 | hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 3 | |
364 | wait(.1) | |
365 | end | |
366 | ||
367 | elseif hit.Name~="Handle" or hit.Name~="IgnoreThrowingKnives" and hit.Parent.Name~="Arms_Model" and hit.CanCollide==false then | |
368 | local sound=Instance.new("Sound") | |
369 | sound.Parent=hit | |
370 | sound.SoundId = "rbxassetid://" .. SOUNDS.wallhit[math.random(1,#SOUNDS.wallhit)] | |
371 | sound:Play() | |
372 | sound:Destroy() | |
373 | if hit.Name == "Radio" then | |
374 | else | |
375 | print("Hit Object: " .. hit.Name) | |
376 | local newknife=tool.Handle:clone() | |
377 | newknife.Name="ThrownKnife" | |
378 | newknife.CFrame = CFrame.new(spawnPos, spawnPos + dPos) * CFrame.Angles(math.pi/-2, 0, 0) | |
379 | newknife.Position = targetpos | |
380 | throwingHandle:Destroy() | |
381 | newknife.Anchored=true | |
382 | newknife.CanCollide=true | |
383 | newknife.Transparency=0 | |
384 | newknife.Parent=workspace | |
385 | newknife.Script.Disabled = false | |
386 | wait(7) | |
387 | for i=1,10 do | |
388 | newknife.Transparency=i*.1 | |
389 | wait() | |
390 | end | |
391 | newknife:Destroy() | |
392 | end | |
393 | end | |
394 | ||
395 | end | |
396 | end) | |
397 | end | |
398 | end | |
399 | -- must check if it still exists since we waited | |
400 | if throwingHandle then | |
401 | throwingHandle.CanCollide = true | |
402 | end | |
403 | ||
404 | FUNCTIONS={ | |
405 | ||
406 | CHECKFORFIRSTPERSON=function() | |
407 | if (camera.focus.p - camera.CoordinateFrame.p).magnitude > 1 then | |
408 | return false | |
409 | else | |
410 | return true | |
411 | end | |
412 | end, | |
413 | ||
414 | ANIMS=function(state) | |
415 | if state then | |
416 | mouse.Icon="http://www.roblox.com/asset/?id=139669907" | |
417 | --Start Animation | |
418 | ||
419 | ||
420 | ||
421 | if SETTINGS.tool then | |
422 | tool.GripPos = Vector3.new(0, -0.55, 0) | |
423 | elseif SETTINGS.tool then | |
424 | tool.GripPos = Vector3.new(0, -0.6, 0) | |
425 | elseif SETTINGS.tool then | |
426 | tool.GripPos = Vector3.new(0, -0.65, 0) | |
427 | elseif SETTINGS.tool then | |
428 | tool.GripPos = Vector3.new(0, -0.7, 0) | |
429 | elseif SETTINGS.tool then | |
430 | tool.GripPos = Vector3.new(0, -0.75, 0) | |
431 | elseif SETTINGS.tool then | |
432 | tool.GripPos = Vector3.new(0, -0.8, 0) | |
433 | elseif SETTINGS.tool then | |
434 | tool.GripPos = Vector3.new(0, -0.85, 0) | |
435 | elseif SETTINGS.tool then | |
436 | tool.GripPos = Vector3.new(0, -0.9, 0) | |
437 | elseif SETTINGS.tool then | |
438 | tool.GripPos = Vector3.new(0, -0.95, 0) | |
439 | elseif SETTINGS.tool then | |
440 | tool.GripPos = Vector3.new(0, -1, 0) | |
441 | else | |
442 | print("Invalid tool size! Set to default: " .. SETTINGS.tool.default_tool_size ) | |
443 | ||
444 | if SETTINGS.tool.default_tool_size==.1 then | |
445 | tool.GripPos = Vector3.new(0, -0.55, 0) | |
446 | elseif SETTINGS.tool.default_tool_size==.2 then | |
447 | tool.GripPos = Vector3.new(0, -0.6, 0) | |
448 | elseif SETTINGS.tool.default_tool_size==.3 then | |
449 | tool.GripPos = Vector3.new(0, -0.65, 0) | |
450 | elseif SETTINGS.tool.default_tool_size==.4 then | |
451 | tool.GripPos = Vector3.new(0, -0.7, 0) | |
452 | elseif SETTINGS.tool.default_tool_size==.5 then | |
453 | tool.GripPos = Vector3.new(0, -0.75, 0) | |
454 | elseif SETTINGS.tool.default_tool_size==.6 then | |
455 | tool.GripPos = Vector3.new(0, -0.8, 0) | |
456 | elseif SETTINGS.tool.default_tool_size==.7 then | |
457 | tool.GripPos = Vector3.new(0, -0.85, 0) | |
458 | elseif SETTINGS.tool.default_tool_size==.8 then | |
459 | tool.GripPos = Vector3.new(0, -0.9, 0) | |
460 | elseif SETTINGS.tool.default_tool_size==.9 then | |
461 | tool.GripPos = Vector3.new(0, -0.95, 0) | |
462 | elseif SETTINGS.tool.default_tool_size==1 then | |
463 | tool.GripPos = Vector3.new(0, -1, 0) | |
464 | else | |
465 | print("Invalid default size! Un-equipping and removing Knife...") | |
466 | ||
467 | end | |
468 | end | |
469 | torso=char:FindFirstChild("Torso") | |
470 | leftarm=torso:FindFirstChild("Left Shoulder") | |
471 | if leftarm then | |
472 | leftarm.Parent=nil | |
473 | newarmweld=Instance.new("Weld") | |
474 | newarmweld.Name="LeftWeld" | |
475 | newarmweld.Part0=torso | |
476 | newarmweld.C0 = CFrame.new(-1.5, 0.7, 0) | |
477 | newarmweld.C1 = CFrame.new(0, 0.7, 0) | |
478 | newarmweld.Part1=char:FindFirstChild("Left Arm") | |
479 | newarmweld.Parent=torso | |
480 | end | |
481 | humanoid.WalkSpeed=WalkSpeeds[2] | |
482 | for i = 1, 15, 3 do | |
483 | if equipped then | |
484 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.Angles((-i * (math.pi / 90)),(-i * (math.pi / 90)),(i * (math.pi / 210))) | |
485 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0) * CFrame.Angles((-i * (math.pi / 60)),(i * (math.pi / 90)),(-i * (math.pi / 240))) | |
486 | end | |
487 | wait() | |
488 | end | |
489 | else | |
490 | humanoid.WalkSpeed=WalkSpeeds[1] | |
491 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.new(0,-0.2,0) | |
492 | tool.GripForward = Vector3.new(0,0,-1) | |
493 | newarmweld:Destroy() | |
494 | leftarm.Parent=torso | |
495 | mouse.Icon="" | |
496 | torso:FindFirstChild("Neck").C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
497 | torso:FindFirstChild("Right Shoulder").C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
498 | end | |
499 | end | |
500 | } | |
501 | ||
502 | tool.Equipped:connect(function () | |
503 | equipped=true | |
504 | PlaySound("Equip") | |
505 | FUNCTIONS.ANIMS(true) | |
506 | end) | |
507 | tool.Unequipped:connect(function () | |
508 | equipped=false | |
509 | FUNCTIONS.ANIMS(false) | |
510 | end) | |
511 | tool.Handle.Touched:connect(function (hit) | |
512 | if Attacking then | |
513 | DamageObject(hit) | |
514 | end | |
515 | end) | |
516 | tool.Activated:connect(function () | |
517 | if Attacking then return end | |
518 | if not tool.Enabled then return end | |
519 | justthrown=false | |
520 | justattacked=false | |
521 | if not gettingknife and not justthrown and not Attacking then | |
522 | HeldTime=time() | |
523 | end | |
524 | playcharge=true | |
525 | wait(.15) | |
526 | while gettingknife do | |
527 | wait() | |
528 | end | |
529 | ||
530 | for i = 1, 15, fasterthrow do | |
531 | if playcharge and equipped and not gettingknife and not justthrown and not Attacking then | |
532 | 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))) | |
533 | 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) | |
534 | 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) | |
535 | wait() | |
536 | end | |
537 | end | |
538 | ||
539 | end) | |
540 | tool.Deactivated:connect(function () | |
541 | if not tool.Enabled then return end | |
542 | currTime=time() | |
543 | playcharge=false | |
544 | if HeldTime and currTime - HeldTime > 0.2 and | |
545 | currTime - HeldTime > 0.01 and not justthrown and not gettingknife then | |
546 | if not Attacking and not justattacked then | |
547 | print("Throw") | |
548 | PlaySound("Throw") | |
549 | tool.Handle.Transparency=1 | |
550 | local targetPos = player.Character.Humanoid.TargetPoint | |
551 | local lookAt = (targetPos - player.Character.PrimaryPart.Position).unit | |
552 | local switchEvenOddParity = 1 | |
553 | local angle = math.ceil((1-1)/2)*math.pi/12*switchEvenOddParity | |
554 | ThrowTool(CFrame.Angles(0, angle, 0) * lookAt) | |
555 | HeldTime=0 | |
556 | gettingknife=true | |
557 | mouse.Icon="http://www.roblox.com/asset/?id=139669907" | |
558 | player.Character["Right Arm"].RightGrip.C1 = CFrame.new(0, -0.800000012, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
559 | for i = 1, 15, .8 do | |
560 | if equipped then | |
561 | 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))) | |
562 | 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))) | |
563 | wait() | |
564 | end | |
565 | end | |
566 | justthrown=true | |
567 | tool.Handle.Transparency=0 | |
568 | PlaySound("Equip") | |
569 | mouse.Icon="http://www.roblox.com/asset/?id=139669907" | |
570 | tool.GripForward = Vector3.new(0,0,-1) | |
571 | for i = 1, 15, 1 do | |
572 | if equipped then | |
573 | 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))) | |
574 | wait() | |
575 | end | |
576 | end | |
577 | gettingknife=false | |
578 | for i = 1, 15, 3 do | |
579 | if equipped then | |
580 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.Angles((-i * (math.pi / 90)),(-i * (math.pi / 90)),(i * (math.pi / 210))) | |
581 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0) * CFrame.Angles((-i * (math.pi / 60)),(i * (math.pi / 90)),(-i * (math.pi / 240))) | |
582 | end | |
583 | wait() | |
584 | end | |
585 | end | |
586 | else | |
587 | if not justthrown and not gettingknife then | |
588 | if Attacking then return end | |
589 | print("Attack") | |
590 | HeldTime=0 | |
591 | Attacking=true | |
592 | justattacked=true | |
593 | if math.random(1,2)==1 then | |
594 | for i = 1, 15, 3 do | |
595 | if equipped and not gettingknife and not justthrown then | |
596 | 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))) | |
597 | 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) | |
598 | wait() | |
599 | end | |
600 | end | |
601 | PlaySound("Swing") | |
602 | for i = 1, 15, 3 do | |
603 | if equipped and not gettingknife and not justthrown then | |
604 | 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))) | |
605 | 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))) | |
606 | wait() | |
607 | end | |
608 | end | |
609 | for i = 1, 15, 3 do | |
610 | if equipped and not justthrown and not gettingknife then | |
611 | 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))) | |
612 | wait() | |
613 | end | |
614 | end | |
615 | for i = 1, 15, 3 do | |
616 | equipping=true | |
617 | if equipped and not gettingknife and not justthrown then | |
618 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.Angles((-i * (math.pi / 90)),(-i * (math.pi / 90)),(i * (math.pi / 210))) | |
619 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0) * CFrame.Angles((-i * (math.pi / 60)),(i * (math.pi / 90)),(-i * (math.pi / 240))) | |
620 | end | |
621 | wait() | |
622 | end | |
623 | Attacking=false | |
624 | else | |
625 | for i = 1, 15, 3 do | |
626 | if equipped and not gettingknife and not justthrown then | |
627 | 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))) | |
628 | end | |
629 | wait() | |
630 | end | |
631 | PlaySound("Swing") | |
632 | for i = 1, 15, 3 do | |
633 | if equipped and not gettingknife and not justthrown then | |
634 | 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) | |
635 | 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))) | |
636 | end | |
637 | wait() | |
638 | end | |
639 | for i = 1, 15, 3 do | |
640 | if equipped and not gettingknife and not justthrown then | |
641 | 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) | |
642 | end | |
643 | wait() | |
644 | end | |
645 | for i = 1, 15, 3 do | |
646 | if equipped and not gettingknife and not justthrown then | |
647 | torso:FindFirstChild("Right Shoulder").C1 = rightC1 * CFrame.Angles((-i * (math.pi / 90)),(-i * (math.pi / 90)),(i * (math.pi / 210))) | |
648 | torso:FindFirstChild("LeftWeld").C1 = CFrame.new(-0.2, .7, 0) * CFrame.Angles((-i * (math.pi / 60)),(i * (math.pi / 90)),(-i * (math.pi / 240))) | |
649 | end | |
650 | wait() | |
651 | end | |
652 | Attacking=false | |
653 | end | |
654 | end | |
655 | end | |
656 | end) | |
657 | mouse.Move:connect(function () | |
658 | if equipped and mouse then | |
659 | if (mouse.Hit.p - mouse.Origin.p).unit.y < 0.25 and (mouse.Hit.p - mouse.Origin.p).unit.y > -0.25 then | |
660 | 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)) | |
661 | 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)) | |
662 | 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) | |
663 | end | |
664 | end | |
665 | end) |