Advertisement
Guest User

Untitled

a guest
Feb 24th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.01 KB | None | 0 0
  1.  
  2.  
  3. if script == nil then return end
  4.  
  5.  
  6. Name = "Knife"
  7.  
  8.  
  9. Player = script:FindFirstChild("sammythecreator") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("YOURNAMEHERE")
  10. Name = "Knife"
  11. selected = false
  12. Button1Down = false
  13. damage = 3
  14. canUse = true
  15. swordType = "normal"
  16. swordType2 = "normal"
  17.  
  18.  
  19. function makeParts(format)
  20. local model = Instance.new("Model")
  21. model.Name = Name
  22. model.Parent = Player.Character
  23. local pm2 = Instance.new("Part")
  24. pm2.Name = "Weld Point"
  25. pm2.formFactor = "Symmetric"
  26. pm2.Size = Vector3.new(1, 1, 1)
  27. pm2.BrickColor = BrickColor.new("Really black")
  28. pm2.Transparency = 1
  29. pm2.Locked = true
  30. pm2.CanCollide = false
  31. pm2.TopSurface = 0
  32. pm2.BottomSurface = 0
  33. pm2.Parent = model
  34. if format ~= nil then
  35. local w = Instance.new("Weld")
  36. w.Part0 = pm2
  37. if format == "hand" then
  38. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  39. w.C0 = CFrame.new(0, 1.1, 0.7)
  40. w.C1 = CFrame.new()
  41. w.Parent = pm2
  42. elseif format == "holster" then
  43. w.Part1 = Player.Character:FindFirstChild("Torso")
  44. w.C0 = CFrame.new(0.6, -0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(90), 0)
  45. w.C1 = CFrame.new()
  46. w.Parent = pm2
  47. model.Name = Name.. " (Holstered)"
  48. else
  49. print("Error: Incorrect format string!")
  50. end
  51. end
  52. local pm = Instance.new("Part")
  53. pm.Name = "Handle"
  54. pm.formFactor = "Symmetric"
  55. pm.Size = Vector3.new(1, 1, 1)
  56. pm.BrickColor = BrickColor.new("Really black")
  57. pm.Locked = true
  58. pm.CanCollide = false
  59. pm.TopSurface = 0
  60. pm.BottomSurface = 0
  61. pm.Parent = model
  62. local m = Instance.new("SpecialMesh")
  63. m.MeshType = "Brick"
  64. m.Scale = Vector3.new(0.3, 0.5, 0.1)
  65. m.Parent = pm
  66. local w = Instance.new("Weld")
  67. w.Part0 = pm
  68. w.Part1 = pm2
  69. w.C0 = CFrame.new()
  70. w.C1 = CFrame.new()
  71. w.Parent = pm
  72. local s = Instance.new("Sound")
  73. s.Name = "Slash"
  74. s.SoundId = "rbxasset://sounds/swordslash.wav"
  75. s.Volume = 1
  76. s.Pitch = 2
  77. s.Looped = false
  78. s.Parent = pm
  79. local s = Instance.new("Sound")
  80. s.Name = "Throw"
  81. s.SoundId = "http://www.roblox.com/asset/?id=18426149"
  82. s.Volume = 1
  83. s.Pitch = 1
  84. s.Looped = false
  85. s.Parent = pm
  86. local s = Instance.new("Sound")
  87. s.Name = "Impact"
  88. s.SoundId = "http://www.roblox.com/asset/?id=10209596"
  89. s.Volume = 1
  90. s.Pitch = 1
  91. s.Looped = false
  92. s.Parent = pm
  93. local p = Instance.new("Part")
  94. p.Name = "Grip"
  95. p.formFactor = "Symmetric"
  96. p.Size = Vector3.new(1, 1, 1)
  97. p.BrickColor = BrickColor.new("Really black")
  98. p.CanCollide = false
  99. p.Locked = true
  100. p.TopSurface = 0
  101. p.BottomSurface = 0
  102. p.Parent = model
  103. local m = Instance.new("SpecialMesh")
  104. m.MeshType = "Brick"
  105. m.Scale = Vector3.new(0.25, 0.4, 0.9)
  106. m.Parent = p
  107. local w = Instance.new("Weld")
  108. w.Part0 = p
  109. w.Part1 = pm
  110. w.C0 = CFrame.new(0, 0, -0.5)
  111. w.C1 = CFrame.new()
  112. w.Parent = p
  113. local p = Instance.new("Part")
  114. p.Name = "Blade"
  115. p.formFactor = "Symmetric"
  116. p.Size = Vector3.new(1, 1, 1)
  117. p.BrickColor = BrickColor.new("Industrial white")
  118. p.Reflectance = 0.2
  119. p.Locked = true
  120. p.CanCollide = false
  121. p.TopSurface = 0
  122. p.BottomSurface = 0
  123. p.Parent = model
  124. local m = Instance.new("BlockMesh")
  125. m.Scale = Vector3.new(0.01, 0.3, 0.85)
  126. m.Parent = p
  127. local w = Instance.new("Weld")
  128. w.Part0 = p
  129. w.Part1 = pm
  130. w.C0 = CFrame.new(0, 0, 0.4)
  131. w.C1 = CFrame.new()
  132. w.Parent = p
  133. p.Touched:connect(function(hit) onTouched(hit, p, "sword") end)
  134. local p = Instance.new("Part")
  135. p.Name = "Blade Tip"
  136. p.formFactor = "Symmetric"
  137. p.Size = Vector3.new(1, 1, 1)
  138. p.BrickColor = BrickColor.new("Industrial white")
  139. p.Reflectance = 0.2
  140. p.CanCollide = false
  141. p.Locked = true
  142. p.TopSurface = 0
  143. p.BottomSurface = 0
  144. p.Parent = model
  145. local m = Instance.new("SpecialMesh")
  146. m.MeshType = "Wedge"
  147. m.Scale = Vector3.new(0.01, 0.3, 0.35)
  148. m.Parent = p
  149. local w = Instance.new("Weld")
  150. w.Part0 = p
  151. w.Part1 = pm
  152. w.C0 = CFrame.new(0, 0, 1) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(180))
  153. w.C1 = CFrame.new()
  154. w.Parent = p
  155. p.Touched:connect(function(hit) onTouched(hit, p, "sword") end)
  156. end
  157.  
  158.  
  159. function removeParts(format)
  160. if format == "hand" then
  161. if Player.Character:FindFirstChild(Name) ~= nil then
  162. Player.Character[Name]:Remove()
  163. end
  164. elseif format == "holster" then
  165. if Player.Character:FindFirstChild(Name.. " (Holstered)") ~= nil then
  166. Player.Character[Name.. " (Holstered)"]:Remove()
  167. end
  168. end
  169. end
  170.  
  171.  
  172. function onTouched(hit, source, format)
  173. if format == "sword" then
  174. if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent ~= Player.Character then
  175. tagHumanoid(hit.Parent.Humanoid)
  176. if swordType == "normal" then
  177. hit.Parent.Humanoid:TakeDamage(2)
  178. elseif swordType == "slash" then
  179. hit.Parent.Humanoid:TakeDamage(damage)
  180. elseif swordType == "stab" then
  181. --Weld(hit, source)
  182. local OldHealth = hit.Parent.Humanoid.Health
  183. wait(0.5)
  184. hit.Parent.Humanoid.Health = 0
  185. end
  186. delay(3, function() untagHumanoid(hit.Parent.Humanoid) end)
  187. end
  188. end
  189. end
  190.  
  191.  
  192. function SetAngle(Joint, Angle, Character)
  193. if Character == nil then return false end
  194. local Joints = {
  195. Character.Torso:FindFirstChild("Right Shoulder 2"),
  196. Character.Torso:FindFirstChild("Left Shoulder 2"),
  197. Character.Torso:FindFirstChild("Right Hip 2"),
  198. Character.Torso:FindFirstChild("Left Hip 2")
  199. }
  200. if Joints[Joint] == nil then return false end
  201. if Joint == 1 or Joint == 3 then
  202. Joints[Joint].DesiredAngle = Angle
  203. end
  204. if Joint == 2 or Joint == 4 then
  205. Joints[Joint].DesiredAngle = -Angle
  206. end
  207. end
  208.  
  209.  
  210. function ForceAngle(Joint, Angle, Character)
  211. if Character == nil then return false end
  212. local Joints = {
  213. Character.Torso:FindFirstChild("Right Shoulder 2"),
  214. Character.Torso:FindFirstChild("Left Shoulder 2"),
  215. Character.Torso:FindFirstChild("Right Hip 2"),
  216. Character.Torso:FindFirstChild("Left Hip 2")
  217. }
  218. if Joints[Joint] == nil then return false end
  219. if Joint == 1 or Joint == 3 then
  220. Joints[Joint].DesiredAngle = Angle
  221. Joints[Joint].CurrentAngle = Angle
  222. end
  223. if Joint == 2 or Joint == 4 then
  224. Joints[Joint].DesiredAngle = -Angle
  225. Joints[Joint].CurrentAngle = -Angle
  226. end
  227. end
  228.  
  229.  
  230. function SetSpeed(Joint, Speed, Character)
  231. if Character == nil then return false end
  232. local Joints = {
  233. Character.Torso:FindFirstChild("Right Shoulder 2"),
  234. Character.Torso:FindFirstChild("Left Shoulder 2"),
  235. Character.Torso:FindFirstChild("Right Hip 2"),
  236. Character.Torso:FindFirstChild("Left Hip 2")
  237. }
  238. if Joints[Joint] == nil then return false end
  239. Joints[Joint].MaxVelocity = Speed
  240. end
  241.  
  242.  
  243. function DisableLimb(Limb, Character)
  244. if Character == nil then return false end
  245. if Character:FindFirstChild("Torso") == nil then return false end
  246. local Joints = {
  247. Character.Torso:FindFirstChild("Right Shoulder"),
  248. Character.Torso:FindFirstChild("Left Shoulder"),
  249. Character.Torso:FindFirstChild("Right Hip"),
  250. Character.Torso:FindFirstChild("Left Hip")
  251. }
  252. local Limbs = {
  253. Character:FindFirstChild("Right Arm"),
  254. Character:FindFirstChild("Left Arm"),
  255. Character:FindFirstChild("Right Leg"),
  256. Character:FindFirstChild("Left Leg")
  257. }
  258. if Joints[Limb] == nil then return false end
  259. if Limbs[Limb] == nil then return false end
  260. local Joint = Instance.new("Motor")
  261. Joint.Parent = Character.Torso
  262. Joint.Part0 = Character.Torso
  263. Joint.Part1 = Limbs[Limb]
  264. if Limb == 1 then
  265. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  266. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  267. Joint.Name = "Right Shoulder 2"
  268. elseif Limb == 2 then
  269. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  270. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  271. Joint.Name = "Left Shoulder 2"
  272. elseif Limb == 3 then
  273. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  274. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  275. Joint.Name = "Right Hip 2"
  276. elseif Limb == 4 then
  277. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  278. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  279. Joint.Name = "Left Hip 2"
  280. end
  281. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  282. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  283. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  284. Joints[Limb]:Remove()
  285. end
  286.  
  287.  
  288. function ResetLimbCFrame(Limb, Character)
  289. if Character == nil then return false end
  290. if Character.Parent == nil then return false end
  291. if Character:FindFirstChild("Torso") == nil then return false end
  292. local Joints = {
  293. Character.Torso:FindFirstChild("Right Shoulder 2"),
  294. Character.Torso:FindFirstChild("Left Shoulder 2"),
  295. Character.Torso:FindFirstChild("Right Hip 2"),
  296. Character.Torso:FindFirstChild("Left Hip 2")
  297. }
  298. local Limbs = {
  299. Character:FindFirstChild("Right Arm"),
  300. Character:FindFirstChild("Left Arm"),
  301. Character:FindFirstChild("Right Leg"),
  302. Character:FindFirstChild("Left Leg")
  303. }
  304. if Joints[Limb] == nil then return false end
  305. if Limbs[Limb] == nil then return false end
  306. if Limb == 1 then
  307. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  308. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  309. elseif Limb == 2 then
  310. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  311. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  312. elseif Limb == 3 then
  313. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  314. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  315. elseif Limb == 4 then
  316. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  317. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  318. end
  319. end
  320.  
  321.  
  322. function EnableLimb(Limb, Character)
  323. if Character == nil then return false end
  324. if Character:FindFirstChild("Torso") == nil then return false end
  325. local Joints = {
  326. Character.Torso:FindFirstChild("Right Shoulder 2"),
  327. Character.Torso:FindFirstChild("Left Shoulder 2"),
  328. Character.Torso:FindFirstChild("Right Hip 2"),
  329. Character.Torso:FindFirstChild("Left Hip 2")
  330. }
  331. local Limbs = {
  332. Character:FindFirstChild("Right Arm"),
  333. Character:FindFirstChild("Left Arm"),
  334. Character:FindFirstChild("Right Leg"),
  335. Character:FindFirstChild("Left Leg")
  336. }
  337. if Joints[Limb] == nil then return false end
  338. if Limbs[Limb] == nil then return false end
  339. if Limb == 1 then
  340. Joints[Limb].Name = "Right Shoulder"
  341. elseif Limb == 2 then
  342. Joints[Limb].Name = "Left Shoulder"
  343. elseif Limb == 3 then
  344. Joints[Limb].Name = "Right Hip"
  345. elseif Limb == 4 then
  346. Joints[Limb].Name = "Left Hip"
  347. end
  348. Animate = Character:FindFirstChild("Animate")
  349. if Animate == nil then return false end
  350. Animate = Animate:Clone()
  351. Character.Animate:Remove()
  352. Animate.Parent = Character
  353. end
  354.  
  355.  
  356. function playAnimation(format, mouse)
  357. if format == "normal" then
  358. SetSpeed(1, 0.2, Player.Character)
  359. SetAngle(1, math.rad(90), Player.Character)
  360. end
  361. if format == "slashStart" then
  362. SetSpeed(1, 0.75, Player.Character)
  363. SetAngle(1, math.rad(190), Player.Character)
  364. pcall(function() Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(math.random(70, 110)), 0) end)
  365. pcall(function() Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) end)
  366. end
  367. if format == "slashEnd1" then
  368. SetSpeed(1, 0.9, Player.Character)
  369. SetAngle(1, math.rad(0), Player.Character)
  370. Player.Character[Name].Handle.Slash:Play()
  371. wait(0.2)
  372. ResetLimbCFrame(1, Player.Character)
  373. SetSpeed(1, 0.5, Player.Character)
  374. SetAngle(1, math.rad(90), Player.Character)
  375. end
  376. if format == "slashEnd2" then
  377. SetSpeed(1, 0.9, Player.Character)
  378. SetAngle(1, math.rad(25), Player.Character)
  379. Player.Character[Name].Handle.Slash:Play()
  380. wait(0.3)
  381. ResetLimbCFrame(1, Player.Character)
  382. SetSpeed(1, 0.1, Player.Character)
  383. SetAngle(1, math.rad(90), Player.Character)
  384. end
  385. if format == "equip1" then
  386. for i = 1, 0, -0.1 do
  387. Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 0, i * 1.25) * CFrame.fromEulerAnglesXYZ(math.rad(i * (180 + 360)), 0, 0)
  388. wait()
  389. end
  390. end
  391. if format == "equip2" then
  392. for i = 0, 1, 0.1 do
  393. Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 0, i * 1.25) * CFrame.fromEulerAnglesXYZ(math.rad(i * (180 + 360)), 0, 0)
  394. wait()
  395. end
  396. end
  397. end
  398.  
  399.  
  400. function Weld(x, y)
  401. local weld = Instance.new("Weld")
  402. weld.Part0 = x
  403. weld.Part1 = y
  404. CJ = CFrame.new(x.Position)
  405. C0 = x.CFrame:inverse() * CJ
  406. C1 = y.CFrame:inverse() * CJ
  407. weld.C0 = C0
  408. weld.C1 = C1
  409. weld.Parent = x
  410. end
  411.  
  412.  
  413. function tagHumanoid(humanoid)
  414. local tag = Instance.new("ObjectValue")
  415. tag.Name = "creator"
  416. tag.Value = Player
  417. tag.Parent = humanoid
  418. local tag = Instance.new("StringValue")
  419. tag.Name = "creatorType1"
  420. tag.Value = Name
  421. tag.Parent = humanoid
  422. local tag = Instance.new("StringValue")
  423. tag.Name = "creatorType2"
  424. tag.Value = "stabbed"
  425. tag.Parent = humanoid
  426. end
  427.  
  428.  
  429. function untagHumanoid(humanoid)
  430. if humanoid ~= nil then
  431. local tag = humanoid:FindFirstChild("creator")
  432. if tag ~= nil then
  433. tag:Remove()
  434. end
  435. local tag = humanoid:FindFirstChild("creatorType1")
  436. if tag ~= nil then
  437. tag:Remove()
  438. end
  439. local tag = humanoid:FindFirstChild("creatorType2")
  440. if tag ~= nil then
  441. tag:Remove()
  442. end
  443. end
  444. end
  445.  
  446.  
  447. function onButton1Down(mouse)
  448. if selected == false then return end
  449. if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canUse == true then
  450. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  451. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  452. playAnimation("slashStart")
  453. Button1Down = true
  454. end
  455. end
  456.  
  457.  
  458. function onButton1Up(mouse)
  459. if selected == false or Button1Down == false then return end
  460. Button1Down = false
  461. if canUse == false then return end
  462. canUse = false
  463. coroutine.resume(coroutine.create(function()
  464. for i = 1, 2 do
  465. if Player.Character:FindFirstChild(Name) == nil then break end
  466. if Player.Character[Name]:FindFirstChild("Blade") ~= nil then
  467. local part = Player.Character[Name].Blade:Clone()
  468. part.Anchored = true
  469. part.CanCollide = false
  470. part.Parent = game:GetService("Workspace")
  471. coroutine.resume(coroutine.create(function(part2) for i = 0, 1, 0.1 do part2.Transparency = i wait() end part2:Remove() end), part)
  472. end
  473. if Player.Character[Name]:FindFirstChild("Blade Tip") ~= nil then
  474. local part = Player.Character[Name]["Blade Tip"]:Clone()
  475. part.Anchored = true
  476. part.CanCollide = false
  477. part.Parent = game:GetService("Workspace")
  478. coroutine.resume(coroutine.create(function(part2) for i = 0, 1, 0.1 do part2.Transparency = i wait() end part2:Remove() end), part)
  479. end
  480. wait()
  481. end
  482. end))
  483. if swordType2 == "normal" then
  484. swordType = "slash"
  485. playAnimation("slashEnd1")
  486. wait(0.1)
  487. elseif swordType2 == "stab" then
  488. swordType = "stab"
  489. playAnimation("slashEnd2")
  490. wait(1)
  491. end
  492. canUse = true
  493. swordType = "normal"
  494. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  495. end
  496.  
  497.  
  498. function onKeyDown(key, mouse)
  499. if selected == false then return end
  500. key = key:lower()
  501. if key == "q" and Button1Down == false and canUse == true then
  502. if mouse.Target == nil then return end
  503. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  504. onDeselected(mouse)
  505. removeParts("holster")
  506. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  507. end
  508. end
  509. if key == "e" and Button1Down == false and canUse == true then
  510. if swordType2 == "normal" then
  511. swordType2 = "stab"
  512. canUse = false
  513. playAnimation("equip2")
  514. canUse = true
  515. elseif swordType2 == "stab" then
  516. swordType2 = "normal"
  517. canUse = false
  518. playAnimation("equip1")
  519. canUse = true
  520. end
  521. end
  522. if key == "-" and Button1Down == false and canUse == true then
  523. if mouse.Target == nil then return end
  524. if Player.Character:FindFirstChild(Name) == nil then makeParts("hand") end
  525. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  526. canUse = false
  527. SetAngle(1, math.rad(200), Player.Character)
  528. SetSpeed(1, 0.5, Player.Character)
  529. wait(0.3)
  530. SetAngle(1, math.rad(0), Player.Character)
  531. SetSpeed(1, 0.75, Player.Character)
  532. wait(0.05)
  533. if Player.Character[Name].Handle:FindFirstChild("Weld") ~= nil then Player.Character[Name].Handle.Weld:Remove() end
  534. wait(0.2)
  535. local Velocity = Instance.new("BodyVelocity")
  536. Velocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  537. Velocity.velocity = (mouse.Hit.p - Player.Character[Name].Handle.CFrame.p).unit * 100
  538. Velocity.Parent = Player.Character[Name].Handle
  539. local Ang = Instance.new("BodyAngularVelocity")
  540. Ang.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  541. Ang.angularvelocity = Vector3.new(math.random(-25, 25), math.random(-25, 25), math.random(-25, 25))
  542. Ang.Parent = Player.Character[Name].Handle
  543. Player.Character[Name].Handle.Slash:Stop()
  544. Player.Character[Name].Handle.Throw.PlayOnRemove = true
  545. Player.Character[Name].Handle.Throw:Remove()
  546. local model = Player.Character[Name]
  547. model.Parent = game:GetService("Workspace")
  548. model:MakeJoints()
  549. canUse = true
  550. onDeselected(mouse)
  551. removeParts("holster")
  552. local temporary = script.Parent
  553. script.Parent = model
  554. temporary:Remove()
  555. wait(0.1)
  556. local Touched = false
  557. local Touched2 = false
  558. if script.Parent:FindFirstChild("Blade Tip") == nil then return end
  559. if script.Parent:FindFirstChild("Handle") == nil then return end
  560. script.Parent["Blade Tip"].Touched:connect(function(hit)
  561. if hit.Parent == model then return end
  562. if hit.Parent.className == "Hat" then hit:BreakJoints() if hit.Parent.Parent.className == "Model" then hit.Parent.Parent = game:GetService("Workspace") hit.CanCollide = true end end
  563. if Touched == true then return end
  564. Touched = true
  565. script.Parent.Handle.BodyVelocity:Remove()
  566. script.Parent.Handle.BodyAngularVelocity:Remove()
  567. script.Parent.Handle.Impact:Play()
  568. script.Parent.Handle.Slash:Stop()
  569. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  570. if hit.Name == "Head" then
  571. hit.Parent.Humanoid:TakeDamage(1000)
  572. else
  573. hit.Parent.Humanoid:TakeDamage(1000)
  574. wait(2)
  575. local e = Instance.new("Explosion")
  576. e.BlastPressure = 1000000
  577. e.BlastRadius = 5
  578. e.Position = script.Parent["Blade Tip"].Position
  579. e.Parent = game:GetService("Workspace")
  580. end
  581. end
  582. Weld(script.Parent.Handle, hit)
  583. wait(0.1)
  584. wait(3)
  585. Touched2 = true
  586. end)
  587. script.Parent.Handle.Touched:connect(function(hit)
  588. if Touched == true and Touched2 == true then
  589. if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) ~= nil then
  590. local temporary = script.Parent
  591. Tool = Instance.new("HopperBin")
  592. Tool.Name = Name
  593. Tool.Parent = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent).Backpack
  594. script.Parent = Tool
  595. temporary:Remove()
  596. Player = script.Parent.Parent.Parent
  597. end
  598. end
  599. end)
  600. coroutine.resume(coroutine.create(function()
  601. while model ~= nil and Touched == false do
  602. if model:FindFirstChild("Blade") ~= nil then
  603. local part = model.Blade:Clone()
  604. part.Anchored = true
  605. part.CanCollide = false
  606. part.Parent = model
  607. coroutine.resume(coroutine.create(function(part2) for i = 0, 1, 0.1 do part2.Transparency = i wait() end part2:Remove() end), part)
  608. end
  609. if model:FindFirstChild("Blade Tip") ~= nil then
  610. local part = model["Blade Tip"]:Clone()
  611. part.Anchored = true
  612. part.CanCollide = false
  613. part.Parent = model
  614. coroutine.resume(coroutine.create(function(part2) for i = 0, 1, 0.1 do part2.Transparency = i wait() end part2:Remove() end), part)
  615. end
  616. wait()
  617. end
  618. end))
  619. while Touched == false do
  620. script.Parent.Handle.Slash:Play()
  621. wait(0.05)
  622. end
  623. end
  624. if key == "x" and Button1Down == false and canUse == true then
  625. if mouse.Target == nil then return end
  626. if Player.Character:FindFirstChild(Name) == nil then makeParts("hand") end
  627. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  628. canUse = false
  629. playAnimation("equip2")
  630. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  631. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  632. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  633. end
  634. ForceAngle(1, 0, Player.Character)
  635. SetAngle(1, math.rad(-50), Player.Character)
  636. SetSpeed(1, 0.3, Player.Character)
  637. wait(0.2)
  638. for i = 90, 200, 20 do
  639. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  640. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(i), math.rad(5), 0)
  641. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  642. end
  643. wait()
  644. end
  645. wait(0.3)
  646. for i = 200, 50, -50 do
  647. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  648. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(i), math.rad(5), 0)
  649. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  650. end
  651. wait()
  652. end
  653. wait(0.1)
  654. for i = 1, 0, -0.01 do
  655. Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth * i
  656. Player.Character.Humanoid.WalkSpeed = i * 16
  657. wait()
  658. end
  659. canUse = true
  660. onDeselected(mouse)
  661. removeParts("holster")
  662. Player.Character.Humanoid.Health = 0
  663. end
  664. end
  665.  
  666.  
  667. function onSelected(mouse)
  668. if selected == true then return end
  669. selected = true
  670. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  671. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  672. if Player.Character.WeaponActivated.Value == nil then break end
  673. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  674. wait()
  675. end
  676. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  677. local weapon = Instance.new("ObjectValue")
  678. weapon.Name = "WeaponActivated"
  679. weapon.Value = script.Parent
  680. weapon.Parent = Player.Character
  681. DisableLimb(1, Player.Character)
  682. removeParts("holster")
  683. makeParts("hand")
  684. playAnimation("normal")
  685. if swordType2 == "normal" then playAnimation("equip1") elseif swordType2 == "stab" then playAnimation("equip2") end
  686. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  687. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  688. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  689. end
  690.  
  691.  
  692. function onDeselected(mouse)
  693. if selected == false then return end
  694. Button1Down = false
  695. onButton1Up(nil)
  696. selected = false
  697. while canUse == false do
  698. wait()
  699. end
  700. while canUse == false do
  701. wait()
  702. end
  703. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  704. if Player.Character.WeaponActivated.Value == script.Parent then
  705. Player.Character.WeaponActivated:Remove()
  706. end
  707. end
  708. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  709. if Player.Character.WeaponActivated.Value == nil then break end
  710. if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end
  711. wait()
  712. end
  713. swordType = "normal"
  714. EnableLimb(1, Player.Character)
  715. removeParts("hand")
  716. makeParts("holster")
  717. end
  718.  
  719.  
  720. if script.Parent.className ~= "HopperBin" then
  721. if Player == nil then print("Error: Player not found!") return end
  722. Tool = Instance.new("HopperBin")
  723. Tool.Name = Name
  724. Tool.Parent = Player.Backpack
  725. script.Name = "Main"
  726. script.Parent = Tool
  727. elseif script.Parent.className == "HopperBin" then
  728. while script.Parent.Parent.className ~= "Backpack" do
  729. wait()
  730. end
  731. Player = script.Parent.Parent.Parent
  732. makeParts("holster")
  733. script.Parent.Selected:connect(onSelected)
  734. script.Parent.Deselected:connect(onDeselected)
  735. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement