RFagot22

Untitled

Jan 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.56 KB | None | 0 0
  1. --[[
  2. Combat Knife
  3. Standard issue knife. Serrated edge for maximum cutting power.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. ModelName = "Combat Knife"
  11. Player = script:FindFirstChild("IlariTheBest") ~= nil and script.Player.Value or game:GetService("IlariTheBest"):FindFirstChild("IlariTheBest")
  12. Selected = false
  13. Connected = false
  14. Button1Down = false
  15. CanUse = true
  16. Ready = false
  17. FirstPerson = game:GetService("InsertService"):LoadAsset(60568552)["FirstPerson"].Value
  18. MouseAim = game:GetService("InsertService"):LoadAsset(61527949)["MouseAim"].Value
  19.  
  20.  
  21. function CheckPlayer()
  22. if Player.Character == nil then return false end
  23. if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
  24. if Player.Character.Humanoid.Health <= 0 then return false end
  25. return true
  26. end
  27.  
  28.  
  29. loadstring(game:GetService("InsertService"):LoadAsset(65363615)["tagHumanoid"].Value)()
  30.  
  31.  
  32. loadstring(game:GetService("InsertService"):LoadAsset(63178291)["CameraPunch"].Value)()
  33.  
  34.  
  35. loadstring(game:GetService("InsertService"):LoadAsset(62991657)["PacketFunctions"].Value)()
  36.  
  37.  
  38. function CreateParts(Parent, Format)
  39. if Parent == nil then return end
  40. local Parts = Instance.new("Model")
  41. Parts.Name = ModelName
  42. if Format == 1 then
  43. Parts.Name = Parts.Name.. " (Holstered)"
  44. end
  45. Parts.Parent = Parent
  46.  
  47. local MasterPart1 = Instance.new("Part")
  48. MasterPart1.Name = "Sheath"
  49. MasterPart1.BrickColor = BrickColor.new("Really black")
  50. MasterPart1.TopSurface = 0
  51. MasterPart1.BottomSurface = 0
  52. MasterPart1.FormFactor = "Custom"
  53. MasterPart1.Size = Vector3.new(1, 1, 1)
  54. MasterPart1.Parent = Parts
  55. local Mesh = Instance.new("SpecialMesh")
  56. Mesh.MeshType = "Brick"
  57. Mesh.Scale = Vector3.new(0.3, 0.5, 1.2)
  58. Mesh.Parent = MasterPart1
  59. local Weld = Instance.new("Weld")
  60. Weld.Part0 = MasterPart1
  61. Weld.Part1 = Player.Character:FindFirstChild("Right Leg")
  62. Weld.C0 = CFrame.new(-0.6, 0.8, 0.85) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  63. Weld.Parent = Weld.Part0
  64.  
  65. local MasterPart2 = Instance.new("Part")
  66. MasterPart2.Name = "Handle"
  67. MasterPart2.BrickColor = BrickColor.new("Black")
  68. MasterPart2.TopSurface = 0
  69. MasterPart2.BottomSurface = 0
  70. MasterPart2.FormFactor = "Custom"
  71. MasterPart2.Size = Vector3.new(1, 1, 1)
  72. MasterPart2.Parent = Parts
  73. local Mesh = Instance.new("SpecialMesh")
  74. Mesh.MeshType = "Brick"
  75. Mesh.Scale = Vector3.new(0.25, 0.4, 0.9)
  76. Mesh.Parent = MasterPart2
  77. local Weld = Instance.new("Weld")
  78. Weld.Part0 = MasterPart2
  79. if Format == 1 then
  80. Weld.Part1 = Player.Character:FindFirstChild("Right Leg")
  81. Weld.C0 = CFrame.new(-0.6, 0.8, -0.3) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  82. elseif Format == 2 then
  83. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  84. Weld.C1 = CFrame.new(0, -1.1, -0.1)
  85. end
  86. Weld.Parent = Weld.Part0
  87.  
  88. local Part = Instance.new("Part")
  89. Part.Name = "Grip"
  90. Part.BrickColor = BrickColor.new("Black")
  91. Part.TopSurface = 0
  92. Part.BottomSurface = 0
  93. Part.FormFactor = "Custom"
  94. Part.Size = Vector3.new(1, 1, 1)
  95. Part.Parent = Parts
  96. local Mesh = Instance.new("SpecialMesh")
  97. Mesh.MeshType = "Brick"
  98. Mesh.Scale = Vector3.new(0.3, 0.5, 0.1)
  99. Mesh.Parent = Part
  100. local Weld = Instance.new("Weld")
  101. Weld.Part0 = Part
  102. Weld.Part1 = MasterPart2
  103. Weld.C0 = CFrame.new(0, 0, 0.5)
  104. Weld.Parent = Weld.Part0
  105.  
  106. local Part = Instance.new("Part")
  107. Part.Name = "Blade"
  108. Part.BrickColor = BrickColor.new("Institutional white")
  109. Part.Reflectance = 0.2
  110. Part.TopSurface = 0
  111. Part.BottomSurface = 0
  112. Part.FormFactor = "Custom"
  113. Part.Size = Vector3.new(1, 1, 1)
  114. Part.Parent = Parts
  115. local Mesh = Instance.new("SpecialMesh")
  116. Mesh.MeshType = "Brick"
  117. Mesh.Scale = Vector3.new(0.01, 0.3, 0.85)
  118. Mesh.Parent = Part
  119. local Weld = Instance.new("Weld")
  120. Weld.Part0 = Part
  121. Weld.Part1 = MasterPart2
  122. Weld.C0 = CFrame.new(0, 0, 0.95)
  123. Weld.Parent = Weld.Part0
  124.  
  125. local Part = Instance.new("Part")
  126. Part.Name = "Blade Tip"
  127. Part.BrickColor = BrickColor.new("Institutional white")
  128. Part.Reflectance = 0.2
  129. Part.TopSurface = 0
  130. Part.BottomSurface = 0
  131. Part.FormFactor = "Custom"
  132. Part.Size = Vector3.new(1, 1, 1)
  133. Part.Parent = Parts
  134. local Mesh = Instance.new("SpecialMesh")
  135. Mesh.MeshType = "Wedge"
  136. Mesh.Scale = Vector3.new(0.01, 0.3, 0.35)
  137. Mesh.Parent = Part
  138. local Weld = Instance.new("Weld")
  139. Weld.Part0 = Part
  140. Weld.Part1 = MasterPart2
  141. Weld.C0 = CFrame.new(0, 0, 1.55) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(180))
  142. Weld.Parent = Weld.Part0
  143.  
  144. for _, Part in pairs(Parts:GetChildren()) do
  145. Part.Locked = true
  146. Part.CanCollide = false
  147. end
  148. end
  149.  
  150.  
  151. function RemoveParts(Parent, Format)
  152. if Format == 1 then
  153. pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  154. elseif Format == 2 then
  155. pcall(function() Parent[ModelName]:Remove() end)
  156. end
  157. end
  158.  
  159.  
  160. function SetAngle(Joint, Angle, Character)
  161. if Character == nil then return false end
  162. local Joints = {
  163. Character.Torso:FindFirstChild("Right Shoulder 2"),
  164. Character.Torso:FindFirstChild("Left Shoulder 2"),
  165. Character.Torso:FindFirstChild("Right Hip 2"),
  166. Character.Torso:FindFirstChild("Left Hip 2")
  167. }
  168. if Joints[Joint] == nil then return false end
  169. if Joint == 1 or Joint == 3 then
  170. Joints[Joint].DesiredAngle = Angle
  171. end
  172. if Joint == 2 or Joint == 4 then
  173. Joints[Joint].DesiredAngle = -Angle
  174. end
  175. end
  176.  
  177.  
  178. function ForceAngle(Joint, Angle, Character)
  179. if Character == nil then return false end
  180. local Joints = {
  181. Character.Torso:FindFirstChild("Right Shoulder 2"),
  182. Character.Torso:FindFirstChild("Left Shoulder 2"),
  183. Character.Torso:FindFirstChild("Right Hip 2"),
  184. Character.Torso:FindFirstChild("Left Hip 2")
  185. }
  186. if Joints[Joint] == nil then return false end
  187. if Joint == 1 or Joint == 3 then
  188. Joints[Joint].DesiredAngle = Angle
  189. Joints[Joint].CurrentAngle = Angle
  190. end
  191. if Joint == 2 or Joint == 4 then
  192. Joints[Joint].DesiredAngle = -Angle
  193. Joints[Joint].CurrentAngle = -Angle
  194. end
  195. end
  196.  
  197.  
  198. function SetSpeed(Joint, Speed, Character)
  199. if Character == nil then return false end
  200. local Joints = {
  201. Character.Torso:FindFirstChild("Right Shoulder 2"),
  202. Character.Torso:FindFirstChild("Left Shoulder 2"),
  203. Character.Torso:FindFirstChild("Right Hip 2"),
  204. Character.Torso:FindFirstChild("Left Hip 2")
  205. }
  206. if Joints[Joint] == nil then return false end
  207. Joints[Joint].MaxVelocity = Speed
  208. end
  209.  
  210.  
  211. function DisableLimb(Limb, Character)
  212. if Character == nil then return false end
  213. if Character:FindFirstChild("Torso") == nil then return false end
  214. local Joints = {
  215. Character.Torso:FindFirstChild("Right Shoulder"),
  216. Character.Torso:FindFirstChild("Left Shoulder"),
  217. Character.Torso:FindFirstChild("Right Hip"),
  218. Character.Torso:FindFirstChild("Left Hip")
  219. }
  220. local Limbs = {
  221. Character:FindFirstChild("Right Arm"),
  222. Character:FindFirstChild("Left Arm"),
  223. Character:FindFirstChild("Right Leg"),
  224. Character:FindFirstChild("Left Leg")
  225. }
  226. if Joints[Limb] == nil then return false end
  227. if Limbs[Limb] == nil then return false end
  228. local Joint = Instance.new("Motor6D")
  229. Joint.Parent = Character.Torso
  230. Joint.Part0 = Character.Torso
  231. Joint.Part1 = Limbs[Limb]
  232. if Limb == 1 then
  233. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  234. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  235. Joint.Name = "Right Shoulder 2"
  236. elseif Limb == 2 then
  237. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  238. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  239. Joint.Name = "Left Shoulder 2"
  240. elseif Limb == 3 then
  241. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  242. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  243. Joint.Name = "Right Hip 2"
  244. elseif Limb == 4 then
  245. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  246. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  247. Joint.Name = "Left Hip 2"
  248. end
  249. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  250. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  251. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  252. Joints[Limb]:Remove()
  253. end
  254.  
  255.  
  256. function ResetLimbCFrame(Limb, Character)
  257. if Character == nil then return false end
  258. if Character.Parent == nil then return false end
  259. if Character:FindFirstChild("Torso") == nil then return false end
  260. local Joints = {
  261. Character.Torso:FindFirstChild("Right Shoulder 2"),
  262. Character.Torso:FindFirstChild("Left Shoulder 2"),
  263. Character.Torso:FindFirstChild("Right Hip 2"),
  264. Character.Torso:FindFirstChild("Left Hip 2")
  265. }
  266. local Limbs = {
  267. Character:FindFirstChild("Right Arm"),
  268. Character:FindFirstChild("Left Arm"),
  269. Character:FindFirstChild("Right Leg"),
  270. Character:FindFirstChild("Left Leg")
  271. }
  272. if Joints[Limb] == nil then return false end
  273. if Limbs[Limb] == nil then return false end
  274. if Limb == 1 then
  275. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  276. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  277. elseif Limb == 2 then
  278. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  279. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  280. elseif Limb == 3 then
  281. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  282. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  283. elseif Limb == 4 then
  284. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  285. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  286. end
  287. end
  288.  
  289.  
  290. function EnableLimb(Limb, Character)
  291. if Character == 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].Name = "Right Shoulder"
  309. elseif Limb == 2 then
  310. Joints[Limb].Name = "Left Shoulder"
  311. elseif Limb == 3 then
  312. Joints[Limb].Name = "Right Hip"
  313. elseif Limb == 4 then
  314. Joints[Limb].Name = "Left Hip"
  315. end
  316. Animate = Character:FindFirstChild("Animate")
  317. if Animate == nil then return false end
  318. Animate = Animate:Clone()
  319. Character.Animate:Remove()
  320. Animate.Parent = Character
  321. end
  322.  
  323.  
  324. function onButton1Down(Mouse)
  325. if Button1Down == true then return end
  326. Button1Down = true
  327. if CheckPlayer() == false or CanUse == false then return end
  328. CanUse = false
  329. SetSpeed(1, 0.8, Player.Character)
  330. SetAngle(1, math.rad(190), Player.Character)
  331. pcall(function()
  332. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(math.random(70, 110)), 0)
  333. end)
  334. CameraSlide(math.rad(5), 0, 0.5)
  335. Ready = true
  336. CanUse = true
  337. end
  338.  
  339.  
  340. function onButton1Up(Mouse)
  341. if Button1Down == false then return end
  342. Button1Down = false
  343. if CheckPlayer() == false then return end
  344. while CanUse == false do wait() end
  345. if Selected == false or Ready == false then return end
  346. CanUse = false
  347. Ready = false
  348. SoundToServer("Slash", "http://www.roblox.com/Asset/?id=10209640", math.random(1500, 2000) / 1000, 1, false, Player.Character.Torso)
  349. SetSpeed(1, 0.9, Player.Character)
  350. SetAngle(1, 0, Player.Character)
  351. local HasHit = false
  352. local _, HitConnection = pcall(function() return Player.Character[ModelName].Blade.Touched:connect(function(Hit)
  353. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  354. HasHit = true
  355. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  356. if Humanoid ~= nil then
  357. SoundToServer("Stab", "http://www.roblox.com/Asset/?id=10209590", math.random(900, 1100) / 1000, 1, false, Player.Character.Torso)
  358. tagHumanoid(Humanoid)
  359. Humanoid:TakeDamage(math.random(10, 30))
  360. wait()
  361. pcall(function() untagHumanoid(Humanoid) end)
  362. else
  363. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=46153268", 2, 0.5, false, Player.Character.Torso)
  364. end
  365. end) end)
  366. CameraSlide(math.rad(-10), 0, 0.2)
  367. ResetLimbCFrame(1, Player.Character)
  368. pcall(function() HitConnection:disconnect() end)
  369. SetSpeed(1, 0.5, Player.Character)
  370. SetAngle(1, math.rad(90), Player.Character)
  371. CameraSlide(math.rad(3), 0, 0.5)
  372. CanUse = true
  373. end
  374.  
  375.  
  376. function onKeyDown(Key, Mouse)
  377. if Selected == false then return end
  378. Key = Key:lower()
  379. if Button1Down == false and CanUse == true and CheckPlayer() == true then
  380. if Key == "q" then
  381. if Mouse.Target == nil then return end
  382. if CheckPlayer() == false then return end
  383. local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  384. if NewPlayer == nil then return end
  385. if NewPlayer.Character == nil then return end
  386. if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  387. if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  388. onDeselected(Mouse)
  389. wait()
  390. RemoveParts(Player.Character, 1)
  391. script.Parent.Parent = NewPlayer.Backpack
  392. Player = NewPlayer
  393. elseif Key == "e" then
  394. CanUse = false
  395. local AimGyroAdd = Instance.new("CFrameValue", Player.Character)
  396. AimGyroAdd.Name = "AimGyroAdd"
  397. pcall(function() Player.Character.Torso.Neck.MaxVelocity = 0 end)
  398. for i = 0, 1, 0.075 do
  399. pcall(function()
  400. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - (0.25 * i), 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90 + (40 * i)), 0)
  401. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90 * i), 0, 0)
  402. Player.Character.Torso.Neck.CurrentAngle = math.rad(70 * i)
  403. end)
  404. AimGyroAdd.Value = CFrame.fromEulerAnglesXYZ(0, math.rad(-70 * i), 0)
  405. wait()
  406. end
  407. pcall(function()
  408. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(130), 0)
  409. Player.Character[ModelName].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  410. Player.Character.Torso.Neck.CurrentAngle = math.rad(70)
  411. end)
  412. AimGyroAdd.Value = CFrame.fromEulerAnglesXYZ(0, math.rad(-70), 0)
  413. wait(0.1)
  414. SoundToServer("Slash", "http://www.roblox.com/Asset/?id=10209640", 0.75, 1, false, Player.Character.Torso)
  415. local HasHit = false
  416. local _, HitConnection = pcall(function() return Player.Character[ModelName].Blade.Touched:connect(function(Hit)
  417. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  418. HasHit = true
  419. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  420. if Humanoid ~= nil then
  421. SoundToServer("Stab", "http://www.roblox.com/Asset/?id=2801263", 0.8, 1, false, Player.Character.Torso)
  422. SoundToServer("Stab", "http://www.roblox.com/Asset/?id=10209590", 0.4, 1, false, Player.Character.Torso)
  423. tagHumanoid(Humanoid)
  424. Humanoid:TakeDamage(math.random(50, 700))
  425. wait()
  426. pcall(function() untagHumanoid(Humanoid) end)
  427. else
  428. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=46153268", 1, 0.75, false, Player.Character.Torso)
  429. end
  430. end) end)
  431. for i = 0, 1, 0.125 do
  432. AimGyroAdd.Value = CFrame.fromEulerAnglesXYZ(0, math.rad(-70 + (160 * i)), 0)
  433. wait()
  434. pcall(function()
  435. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25 + (0.25 * i), 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(130 - (130 * i) + (math.sin(i * math.pi) * 60)), 0)
  436. Player.Character.Torso.Neck.CurrentAngle = math.rad(70 - (160 * i))
  437. end)
  438. end
  439. pcall(function()
  440. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0)
  441. Player.Character.Torso.Neck.CurrentAngle = math.rad(-90)
  442. end)
  443. AimGyroAdd.Value = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  444. HitConnection:disconnect()
  445. wait(0.5)
  446. for i = 0, 1, 0.1 do
  447. pcall(function()
  448. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90 * i), 0)
  449. Player.Character[ModelName].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90 * (1 - i)), 0, 0)
  450. Player.Character.Torso.Neck.CurrentAngle = math.rad(-90 * (1 - i))
  451. end)
  452. AimGyroAdd.Value = CFrame.fromEulerAnglesXYZ(0, math.rad(90 * (1 - i)), 0)
  453. wait()
  454. end
  455. ResetLimbCFrame(1, Player.Character)
  456. pcall(function()
  457. Player.Character.Torso.Neck.MaxVelocity = 0.1
  458. Player.Character.Torso.Neck.CurrentAngle = 0
  459. end)
  460. AimGyroAdd:Remove()
  461. CanUse = true
  462. elseif Key == "r" then
  463. CanUse = false
  464. for i = 0, 1, 0.1 do
  465. wait()
  466. pcall(function()
  467. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90 * (1 - i)), 0)
  468. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90 * i), math.rad(90 * i), 0)
  469. end)
  470. end
  471. pcall(function()
  472. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
  473. Player.Character[ModelName].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(90), 0)
  474. end)
  475. SoundToServer("Slash", "http://www.roblox.com/Asset/?id=10209850", 1.1, 1, false, Player.Character.Torso)
  476. local AimGyroAdd = Instance.new("CFrameValue", Player.Character)
  477. AimGyroAdd.Name = "AimGyroAdd"
  478. local HasHit = false
  479. local _, HitConnection = pcall(function() return Player.Character[ModelName].Blade.Touched:connect(function(Hit)
  480. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  481. HasHit = true
  482. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  483. if Humanoid ~= nil then
  484. SoundToServer("Stab", "http://www.roblox.com/Asset/?id=10209590", 0.5, 1, false, Player.Character.Torso)
  485. tagHumanoid(Humanoid)
  486. Humanoid:TakeDamage(math.random(10, 40))
  487. wait()
  488. pcall(function() untagHumanoid(Humanoid) end)
  489. else
  490. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=46153268", 1.5, 0.75, false, Player.Character.Torso)
  491. end
  492. end) end)
  493. for i = 0, 1, 0.1 do
  494. AimGyroAdd.Value = CFrame.fromEulerAnglesXYZ(0, math.rad(i * 360), 0)
  495. wait()
  496. end
  497. HitConnection:disconnect()
  498. for i = 0, 1, 0.1 do
  499. pcall(function()
  500. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90 * i), 0)
  501. Player.Character[ModelName].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90 * (1 - i)), 0, 0)
  502. end)
  503. wait()
  504. end
  505. ResetLimbCFrame(1, Player.Character)
  506. AimGyroAdd:Remove()
  507. CanUse = true
  508. elseif Key == "z" then
  509. CanUse = false
  510. SoundToServer("Throw", "http://www.roblox.com/Asset/?id=18426149", 0.9, 1, false, Player.Character.Torso)
  511. SetSpeed(1, 0.55, Player.Character)
  512. SetAngle(1, math.rad(200), Player.Character)
  513. wait(0.2)
  514. SetSpeed(1, 0.7, Player.Character)
  515. SetAngle(1, 0, Player.Character)
  516. wait()
  517. pcall(function() Player.Character[ModelName].Handle.Weld:Remove() end)
  518. for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
  519. if Part.Name ~= "Blade Tip" then
  520. pcall(function() Part.CanCollide = true end)
  521. end
  522. end
  523. local BodyVelocity = Instance.new("BodyVelocity")
  524. BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  525. BodyVelocity.velocity = (Mouse.Hit.p - Player.Character[ModelName].Handle.Position).unit * 150
  526. BodyVelocity.Parent = Player.Character[ModelName].Handle
  527. local BodyGyro = Instance.new("BodyGyro", Player.Character[ModelName].Handle)
  528. BodyGyro.P = 5000
  529. BodyGyro.D = 100
  530. BodyGyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  531. BodyGyro.cframe = CFrame.new(Player.Character[ModelName].Handle.Position, Mouse.Hit.p)
  532. local Find1 = math.random()
  533. local ParentObject = Instance.new("ObjectValue", Workspace)
  534. ParentObject.Name = Find1
  535. ParentObject.Value = Player.Character[ModelName]:FindFirstChild("Blade")
  536. local Find2 = math.random()
  537. local Clone = script:Clone()
  538. Clone.Disabled = true
  539. Clone.Name = Find2
  540. pcall(function() Clone.Player:Remove() end)
  541. pcall(function() Clone.ModelType:Remove() end)
  542. Clone.Parent = Workspace
  543. tagHumanoid(Player.Character[ModelName]:FindFirstChild("Blade"))
  544. wait(0.1)
  545. SendToServer([[local Value = Workspace["]] ..Find1.. [["]
  546. local Source = Value.Value
  547. Value:Remove()
  548. local Clone = Workspace["]] ..Find2.. [["]
  549. Clone.Parent = nil
  550. Clone.Disabled = false
  551. Status = 0
  552. Source.Touched:connect(function(Hit)
  553. if Status == 2 then
  554. if Hit.Parent == nil then return end
  555. local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
  556. if Player ~= nil then
  557. local PlayerValue = Instance.new("ObjectValue", Clone)
  558. PlayerValue.Name = "Player"
  559. PlayerValue.Value = Player
  560. Clone.Parent = Workspace
  561. Source.Parent:Remove()
  562. end
  563. elseif Status == 0 then
  564. Status = 1
  565. pcall(function() Source.Parent.Handle.BodyVelocity:Remove() end)
  566. pcall(function() Source.Parent.Handle.BodyGyro:Remove() end)
  567. pcall(function() Source.Parent.Handle.Velocity = Vector3.new() end)
  568. pcall(function() Source.Parent.Handle.RotVelocity = Vector3.new() end)
  569. local Sound = Instance.new("Sound", Source)
  570. Sound.SoundId = "http://www.roblox.com/Asset/?id=10209590"
  571. Sound.Pitch = math.random(400, 500) / 1000
  572. Sound.Volume = 1
  573. Sound:Play()
  574. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  575. if Humanoid ~= nil then
  576. local creator = Source.creator:Clone()
  577. creator.Parent = Humanoid
  578. Humanoid:TakeDamage(math.random(25000, 75000) / 1000)
  579. wait()
  580. creator:Remove()
  581. end
  582. local Weld = Instance.new("Weld")
  583. Weld.Part0 = Source
  584. Weld.Part1 = Hit
  585. Weld.C0 = Source.CFrame:inverse() * CFrame.new(Source.Position)
  586. Weld.C1 = Hit.CFrame:inverse() * CFrame.new(Source.Position)
  587. Weld.Parent = Weld.Part0
  588. wait(3)
  589. Status = 2
  590. end
  591. end)
  592. wait(25)
  593. Source.Parent:Remove()]], "Throw")
  594. pcall(function() Player.Character[ModelName].Sheath:Remove() end)
  595. Player.Character[ModelName].Parent = Workspace
  596. wait(0.5)
  597. EnableLimb(1, Player.Character)
  598. UpdateFirstPerson()
  599. script.Parent:Remove()
  600. end
  601. end
  602. end
  603.  
  604.  
  605. function onSelected(Mouse)
  606. if Selected == true or CanUse == false then return end
  607. CanUse = false
  608. while true do
  609. if CheckPlayer() == true then
  610. if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil then
  611. break
  612. end
  613. end
  614. wait(0.1)
  615. end
  616. Selected = true
  617. DisableLimb(1, Player.Character)
  618. SetSpeed(1, 0.5, Player.Character)
  619. SetAngle(1, 0, Player.Character)
  620. wait(0.4)
  621. RemoveParts(Player.Character, 1)
  622. CreateParts(Player.Character, 2)
  623. SetSpeed(1, 0.2, Player.Character)
  624. SetAngle(1, math.rad(90), Player.Character)
  625. SoundToServer("Sheath", "rbxasset://sounds/\unsheath.wav", 5, 1, false, Player.Character[ModelName]:FindFirstChild("Sheath"))
  626. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0.4, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  627. wait(0.2)
  628. for i = 1, 0, -0.15 do
  629. pcall(function()
  630. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0.4 * i, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180 * i), 0, 0)
  631. end)
  632. CameraPunch(math.rad(1), 0)
  633. wait(0.03)
  634. end
  635. pcall(function()
  636. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new()
  637. end)
  638. CameraSlide(math.rad(-6.25), 0, 0.15)
  639. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  640. Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  641. Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  642. Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  643. CanUse = true
  644. end
  645.  
  646.  
  647. function onDeselected(Mouse)
  648. if Selected == false then return end
  649. Selected = false
  650. while CanUse == false do wait() end
  651. if Selected == true then return end
  652. CanUse = false
  653. SetSpeed(1, 0.3, Player.Character)
  654. SetAngle(1, 0, Player.Character)
  655. SoundToServer("Sheath", "rbxasset://sounds/\unsheath.wav", 4, 1, false, Player.Character[ModelName]:FindFirstChild("Sheath"))
  656. for i = 0, 1, 0.25 do
  657. pcall(function()
  658. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0.4 * i, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180 * i), 0, 0)
  659. end)
  660. CameraPunch(math.rad(-1), 0)
  661. wait()
  662. end
  663. pcall(function()
  664. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0.4, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  665. end)
  666. RemoveParts(Player.Character, 2)
  667. CreateParts(Player.Character, 1)
  668. CameraSlide(math.rad(2.5), 0, 0.25)
  669. DisableLimb(1, Player.Character)
  670. EnableLimb(1, Player.Character)
  671. CanUse = true
  672. end
  673.  
  674.  
  675. if script.Parent.ClassName ~= "HopperBin" then
  676. if Player == nil then print("Error: Player not found!") return end
  677. Tool = Instance.new("HopperBin")
  678. Tool.Name = ModelName
  679. Tool.Parent = Player.Backpack
  680. script.Name = "Main"
  681. script.Parent = Tool
  682. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  683. Connected = true
  684. Player = script.Parent.Parent.Parent
  685. script.Parent.Selected:connect(onSelected)
  686. script.Parent.Deselected:connect(onDeselected)
  687. CreateParts(Player.Character, 1)
  688. coroutine.wrap(loadstring(FirstPerson))()
  689. coroutine.wrap(loadstring(MouseAim))()
  690. end
Add Comment
Please, Sign In to add comment