Advertisement
MrWiggles1029

ROBLOX Combat Knife

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