MrWiggles1029

oiejs

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