Advertisement
gjgj

Untitled

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