Advertisement
MrSlakyx

script

May 12th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.73 KB | None | 0 0
  1. local rad = math.rad
  2. local rand = math.random
  3.  
  4. function makeJoints(model)
  5. for _,v in pairs(model:GetChildren()) do
  6. if v:IsA("BasePart") then
  7. v:MakeJoints()
  8. v.Anchored = false
  9. v.CanCollide = false
  10. else
  11. makeJoints(v)
  12. end
  13. end
  14. end
  15.  
  16. local rightArmJoint = Instance.new("Weld", rightArm)
  17. rightArmJoint.Part0 = nil
  18. rightArmJoint.Part1 = torso
  19. rightArmJoint.C0 = cf(-((torso.Size.X/2) + (rightArm.Size.X/2)),0,0)*angles(0,0,0)
  20. local rightArmOriginCF = cf(-((torso.Size.X/2) + (rightArm.Size.X/2)),0,0)*angles(0,0,0)
  21. local rightArmTargetCF = rightArmOriginCF
  22. local rightArmHoldCF = rightArmOriginCF*angles(rad(-90), 0, 0)*cf(0, -0.5, 0.5)
  23.  
  24. local leftArmJoint = Instance.new("Weld", leftArm)
  25. leftArmJoint.Part0 = nil
  26. leftArmJoint.Part1 = torso
  27. leftArmJoint.C0 = cf((torso.Size.X/2)+(leftArm.Size.X/2),0,0)*angles(0,0,0)
  28. local leftArmOriginCF = cf((torso.Size.X/2)+(leftArm.Size.X/2),0,0)*angles(0,0,0)
  29. local leftArmTargetCF = leftArmOriginCF
  30. local leftArmHoldCF = leftArmOriginCF*angles(rad(-90), 0, 0)*cf(0, -0.5, 0.5)
  31.  
  32. local rightLegJoint = Instance.new("Weld", rightLeg)
  33. rightLegJoint.Part0 = nil
  34. rightLegJoint.Part1 = torso
  35. rightLegJoint.C0 = cf(0, ((torso.Size.Y/2)+(rightLeg.Size.Y/2)), 0)*angles(0,0,0)
  36. local rightLegOriginCF = cf(-(torso.Size.X/2) + rightLeg.Size.X/2, ((torso.Size.Y/2)+(rightLeg.Size.Y/2)), 0)*angles(0,0,0)
  37. local rightLegTargetCF = rightLegOriginCF
  38.  
  39. local leftLegJoint = Instance.new("Weld", leftLeg)
  40. leftLegJoint.Part0 = nil
  41. leftLegJoint.Part1 = torso
  42. leftLegJoint.C0 = cf(0, ((torso.Size.Y/2)+(leftLeg.Size.Y/2)), 0)*angles(0,0,0)
  43. local leftLegOriginCF = cf((torso.Size.X/2) - leftLeg.Size.X/2, ((torso.Size.Y/2)+(leftLeg.Size.Y/2)), 0)*angles(0,0,0)
  44. local leftLegTargetCF = leftLegOriginCF
  45.  
  46. game:GetService("RunService").RenderStepped:connect(function()
  47. leftArmJoint.C0 = leftArmJoint.C0:lerp(leftArmTargetCF, 0.1)
  48. rightArmJoint.C0 = rightArmJoint.C0:lerp(rightArmTargetCF, 0.1)
  49. rightLegJoint.C0 = rightLegJoint.C0:lerp(rightLegTargetCF, 0.1)
  50. leftLegJoint.C0 = leftLegJoint.C0:lerp(leftLegTargetCF, 0.1)
  51. end)
  52.  
  53. local currentSide = 1
  54.  
  55. function weldBetween(p0, p1)
  56. local weld = Instance.new("Weld")
  57. weld.Part0 = p0
  58. weld.Part1 = p1
  59. weld.C0 = p0.CFrame:inverse()
  60. weld.C1 = p1.CFrame:inverse()
  61. weld.Parent = p0
  62. end
  63.  
  64. function weldModel(model, pp)
  65. for _,v in pairs(model:GetChildren()) do
  66. if v:IsA("BasePart") then
  67. local weld = Instance.new("Weld")
  68. weld.Part0 = pp
  69. weld.Part1 = v
  70. weld.C0 = pp.CFrame:inverse()
  71. weld.C1 = v.CFrame:inverse()
  72. weld.Parent = pp
  73. end
  74. end
  75. end
  76.  
  77. function scan(obj)
  78. obj:BreakJoints()
  79. for _,v in pairs(obj:GetChildren()) do
  80. if v:IsA("BasePart") then
  81. v.Anchored = false
  82. v.CanCollide = false
  83. else
  84. scan(v)
  85. end
  86. end
  87. end
  88.  
  89. function surfaceChange(part)
  90. part.TopSurface = 10
  91. part.BottomSurface = 10
  92. part.FrontSurface = 10
  93. part.BackSurface = 10
  94. part.RightSurface = 10
  95. part.LeftSurface = 10
  96. end
  97.  
  98. function createPistol()
  99. local model = Instance.new("Model", char)
  100. model.Name = "Pistol"
  101.  
  102. local mag = Instance.new("Model", model)
  103. mag.Name = "Mag"
  104.  
  105. local m1 = Instance.new("Part", mag)
  106. m1.Name = "Part"
  107. m1.Size = Vector3.new(0.200000003, 0.200000003, 0.323524684)
  108. m1.CFrame = CFrame.new(-11.2802582, 0.178448141, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  109. m1.Anchored = false
  110. m1.CanCollide = false
  111. m1.BrickColor = BrickColor.new("White")
  112. surfaceChange(m1)
  113. local m2 = Instance.new("Part", mag)
  114. m2.Name = "Part"
  115. m2.Size = Vector3.new(0.647049308, 0.200000003, 0.323524684)
  116. m2.CFrame = CFrame.new(-11.5902891, 0.13587451, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  117. m2.Anchored = false
  118. m2.CanCollide = false
  119. m2.BrickColor = BrickColor.new("White")
  120. surfaceChange(m2)
  121. local m3 = Instance.new("Part", mag)
  122. m3.Name = "Part"
  123. m3.Size = Vector3.new(0.307348371, 0.200000003, 0.323524684)
  124. m3.CFrame = CFrame.new(-11.4223385, 0.161293387, 16.346323, 0.988745034, -0.149589986, 0, 0.149582624, 0.9887532, 0, 0, 0, 1)
  125. m3.Anchored = false
  126. m3.CanCollide = false
  127. m3.BrickColor = BrickColor.new("White")
  128. surfaceChange(m3)
  129. local m4 = Instance.new("Part", mag)
  130. m4.Name = "Part"
  131. m4.Size = Vector3.new(0.200000003, 0.200000003, 0.323524684)
  132. m4.CFrame = CFrame.new(-11.9297647, 0.157671332, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  133. m4.Anchored = false
  134. m4.CanCollide = false
  135. m4.BrickColor = BrickColor.new("White")
  136. surfaceChange(m4)
  137. local m5 = Instance.new("Part", mag)
  138. m5.Name = "PP"
  139. m5.Size = Vector3.new(0.541903794, 1.01101518, 0.200000003)
  140. m5.CFrame = CFrame.new(-11.5822363, 0.680492878, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  141. m5.Anchored = false
  142. m5.CanCollide = false
  143. m5.BrickColor = BrickColor.new("White")
  144. surfaceChange(m5)
  145. local p2 = Instance.new("Part", model)
  146. p2.Name = "Handle"
  147. p2.Size = Vector3.new(0.541903794, 1.01101518, 0.200000003)
  148. p2.CFrame = CFrame.new(-11.5822363, 0.680492878, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  149. p2.Anchored = false
  150. p2.CanCollide = false
  151. p2.BrickColor = BrickColor.new("Medium stone grey")
  152. surfaceChange(p2)
  153. local p3 = Instance.new("Part", model)
  154. p3.Name = "Part"
  155. p3.Size = Vector3.new(0.541903794, 1.01910317, 0.200000003)
  156. p3.CFrame = CFrame.new(-11.5817852, 0.684512913, 16.4555092, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  157. p3.Anchored = false
  158. p3.CanCollide = false
  159. p3.BrickColor = BrickColor.new("Smoky grey")
  160. surfaceChange(p3)
  161. local p4 = Instance.new("Part", model)
  162. p4.Name = "Part"
  163. p4.Size = Vector3.new(0.541903794, 1.01910317, 0.200000003)
  164. p4.CFrame = CFrame.new(-11.5817852, 0.684512913, 16.2371349, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  165. p4.Anchored = false
  166. p4.CanCollide = false
  167. p4.BrickColor = BrickColor.new("Smoky grey")
  168. surfaceChange(p4)
  169. local p5 = Instance.new("Part", model)
  170. p5.Name = "Part"
  171. p5.Size = Vector3.new(0.200000003, 1.05954385, 0.274995983)
  172. p5.CFrame = CFrame.new(-11.8694487, 0.696427584, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  173. p5.Anchored = false
  174. p5.CanCollide = false
  175. p5.BrickColor = BrickColor.new("Smoky grey")
  176. surfaceChange(p5)
  177. local p6 = Instance.new("Part", model)
  178. p6.Name = "Part"
  179. p6.Size = Vector3.new(0.200000003, 1.05954385, 0.274995983)
  180. p6.CFrame = CFrame.new(-11.2986317, 0.63239634, 16.346323, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  181. p6.Anchored = false
  182. p6.CanCollide = false
  183. p6.BrickColor = BrickColor.new("Smoky grey")
  184. surfaceChange(p6)
  185. local p7 = Instance.new("Part", model)
  186. p7.Name = "Part"
  187. p7.Size = Vector3.new(0.3073484, 0.307348609, 0.200000003)
  188. p7.CFrame = CFrame.new(-11.5363941, 0.980687678, 16.4999962, 0.931046963, 0.364899546, 0, -0.364899546, 0.931046903, 0, 0, 0, 1)
  189. p7.Anchored = false
  190. p7.CanCollide = false
  191. p7.BrickColor = BrickColor.new("Black")
  192. surfaceChange(p7)
  193. local p8 = Instance.new("Part", model)
  194. p8.Name = "Part"
  195. p8.Size = Vector3.new(0.3073484, 0.630873501, 0.200000003)
  196. p8.CFrame = CFrame.new(-11.6234102, 0.567052245, 16.4999962, 0.993767619, 0.111472785, 0, -0.111472793, 0.99376756, 0, 0, 0, 1)
  197. p8.Anchored = false
  198. p8.CanCollide = false
  199. p8.BrickColor = BrickColor.new("Black")
  200. surfaceChange(p8)
  201. local p9 = Instance.new("Part", model)
  202. p9.Name = "Part"
  203. p9.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  204. p9.CFrame = CFrame.new(-11.3422289, 0.824556589, 16.4999962, -0.9937675, 0, 0.111472867, 0.111472875, 0, 0.9937675, 0, 1, 0)
  205. p9.Anchored = false
  206. p9.CanCollide = false
  207. p9.BrickColor = BrickColor.new("Black")
  208. surfaceChange(p9)
  209. local p10 = Instance.new("Part", model)
  210. p10.Name = "Part"
  211. p10.Size = Vector3.new(0.3073484, 0.630873501, 0.200000003)
  212. p10.CFrame = CFrame.new(-11.6234102, 0.567052245, 16.1926479, 0.993767619, 0.111472785, 0, -0.111472793, 0.99376756, 0, 0, 0, 1)
  213. p10.Anchored = false
  214. p10.CanCollide = false
  215. p10.BrickColor = BrickColor.new("Black")
  216. surfaceChange(p10)
  217. local p11 = Instance.new("Part", model)
  218. p11.Name = "Part"
  219. p11.Size = Vector3.new(0.3073484, 0.307348609, 0.200000003)
  220. p11.CFrame = CFrame.new(-11.5363941, 0.980687678, 16.1926479, 0.931046963, 0.364899546, 0, -0.364899546, 0.931046903, 0, 0, 0, 1)
  221. p11.Anchored = false
  222. p11.CanCollide = false
  223. p11.BrickColor = BrickColor.new("Black")
  224. surfaceChange(p11)
  225. local p12 = Instance.new("Part", model)
  226. p12.Name = "Part"
  227. p12.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
  228. p12.CFrame = CFrame.new(-11.9146175, 0.656711042, 16.3503666, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  229. p12.Anchored = false
  230. p12.CanCollide = false
  231. p12.BrickColor = BrickColor.new("Black")
  232. surfaceChange(p12)
  233. local p13 = Instance.new("Part", model)
  234. p13.Name = "Part"
  235. p13.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
  236. p13.CFrame = CFrame.new(-11.8940992, 0.743149281, 16.3503666, 0.988745034, -0.149589986, 0, 0.149582624, 0.9887532, 0, 0, 0, 1)
  237. p13.Anchored = false
  238. p13.CanCollide = false
  239. p13.BrickColor = BrickColor.new("Black")
  240. surfaceChange(p13)
  241. local p14 = Instance.new("Part", model)
  242. p14.Name = "Part"
  243. p14.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  244. p14.CFrame = CFrame.new(-11.8513021, 1.22758293, 16.3503666, 0.828027964, 0.560686827, 0, -0.560686827, 0.828027904, 0, 0, 0, 1)
  245. p14.Anchored = false
  246. p14.CanCollide = false
  247. p14.BrickColor = BrickColor.new("Black")
  248. surfaceChange(p14)
  249. local p15 = Instance.new("Part", model)
  250. p15.Name = "Part"
  251. p15.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
  252. p15.CFrame = CFrame.new(-11.8547096, 0.967769444, 16.3503666, 0.931046963, 0.364899546, 0, -0.364899546, 0.931046903, 0, 0, 0, 1)
  253. p15.Anchored = false
  254. p15.CanCollide = false
  255. p15.BrickColor = BrickColor.new("Black")
  256. surfaceChange(p15)
  257. local p16 = Instance.new("Part", model)
  258. p16.Name = "Part"
  259. p16.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
  260. p16.CFrame = CFrame.new(-11.848114, 0.983309388, 16.3503666, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  261. p16.Anchored = false
  262. p16.CanCollide = false
  263. p16.BrickColor = BrickColor.new("Black")
  264. surfaceChange(p16)
  265. local p17 = Instance.new("Part", model)
  266. p17.Name = "Part"
  267. p17.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
  268. p17.CFrame = CFrame.new(-11.8507061, 1.06176257, 16.3503666, 0.988745034, -0.149589986, 0, 0.149582624, 0.9887532, 0, 0, 0, 1)
  269. p17.Anchored = false
  270. p17.CanCollide = false
  271. p17.BrickColor = BrickColor.new("Black")
  272. surfaceChange(p17)
  273. local p18 = Instance.new("Part", model)
  274. p18.Name = "Part"
  275. p18.Size = Vector3.new(0.376906186, 0.200000003, 0.200000003)
  276. p18.CFrame = CFrame.new(-11.9414015, 1.36785984, 16.3503666, 0.828027964, 0.560686827, 0, -0.560686827, 0.828027904, 0, 0, 0, 1)
  277. p18.Anchored = false
  278. p18.CanCollide = false
  279. p18.BrickColor = BrickColor.new("Black")
  280. surfaceChange(p18)
  281. local p19 = Instance.new("Part", model)
  282. p19.Name = "Part"
  283. p19.Size = Vector3.new(0.200000003, 0.200000003, 0.218379155)
  284. p19.CFrame = CFrame.new(-11.8434582, 1.11297774, 16.3503666, 0.951277733, -0.308335513, 0, 0.308335543, 0.951277614, 0, 0, 0, 1)
  285. p19.Anchored = false
  286. p19.CanCollide = false
  287. p19.BrickColor = BrickColor.new("Black")
  288. surfaceChange(p19)
  289. local p20 = Instance.new("Part", model)
  290. p20.Name = "Part"
  291. p20.Size = Vector3.new(0.200000003, 0.237790748, 0.200000003)
  292. p20.CFrame = CFrame.new(-11.9254217, 1.21484756, 16.3503666, 0.756803453, -0.653634727, 0, 0.653631568, 0.756821513, 0, 0, 0, 1)
  293. p20.Anchored = false
  294. p20.CanCollide = false
  295. p20.BrickColor = BrickColor.new("Black")
  296. surfaceChange(p20)
  297. local p21 = Instance.new("Part", model)
  298. p21.Name = "Part"
  299. p21.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  300. p21.CFrame = CFrame.new(-12.0393581, 1.33804011, 16.3503666, 0.717730284, -0.696321309, 0, 0.696321249, 0.717730284, 0, 0, 0, 1)
  301. p21.Anchored = false
  302. p21.CanCollide = false
  303. p21.BrickColor = BrickColor.new("Black")
  304. surfaceChange(p21)
  305. local p22 = Instance.new("Part", model)
  306. p22.Name = "Part"
  307. p22.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  308. p22.CFrame = CFrame.new(-12.0967665, 1.41755128, 16.3503666, 0.983917534, 0.178622946, 0, -0.178622946, 0.983917534, 0, 0, 0, 1)
  309. p22.Anchored = false
  310. p22.CanCollide = false
  311. p22.BrickColor = BrickColor.new("Black")
  312. surfaceChange(p22)
  313. local p23 = Instance.new("Part", model)
  314. p23.Name = "Part"
  315. p23.Size = Vector3.new(0.271760672, 0.200000003, 0.200000003)
  316. p23.CFrame = CFrame.new(-11.9907618, 1.34500718, 16.3503666, 0.828027964, 0.560686827, 0, -0.560686827, 0.828027904, 0, 0, 0, 1)
  317. p23.Anchored = false
  318. p23.CanCollide = false
  319. p23.BrickColor = BrickColor.new("Black")
  320. surfaceChange(p23)
  321. local p24 = Instance.new("Part", model)
  322. p24.Name = "Part"
  323. p24.Size = Vector3.new(0.604991019, 0.200000003, 0.276613623)
  324. p24.CFrame = CFrame.new(-11.5234394, 1.22756207, 16.3455143, 0.9937675, 0.111472867, 0, -0.111472875, 0.9937675, 0, 0, 0, 1)
  325. p24.Anchored = false
  326. p24.CanCollide = false
  327. p24.BrickColor = BrickColor.new("Black")
  328. surfaceChange(p24)
  329. local p25 = Instance.new("Part", model)
  330. p25.Name = "Part"
  331. p25.Size = Vector3.new(1.74703312, 0.2685256, 0.323524684)
  332. p25.CFrame = CFrame.new(-10.9460964, 1.39836848, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
  333. p25.Anchored = false
  334. p25.CanCollide = false
  335. p25.BrickColor = BrickColor.new("Black")
  336. surfaceChange(p25)
  337. local p26 = Instance.new("Part", model)
  338. p26.Name = "Part"
  339. p26.Size = Vector3.new(0.511169076, 0.200000003, 0.237790659)
  340. p26.CFrame = CFrame.new(-11.4444475, 1.2284658, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
  341. p26.Anchored = false
  342. p26.CanCollide = false
  343. p26.BrickColor = BrickColor.new("Black")
  344. surfaceChange(p26)
  345. local p27 = Instance.new("Part", model)
  346. p27.Name = "Part"
  347. p27.Size = Vector3.new(0.888075173, 0.200000003, 0.31058377)
  348. p27.CFrame = CFrame.new(-10.7495079, 1.20498598, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
  349. p27.Anchored = false
  350. p27.CanCollide = false
  351. p27.BrickColor = BrickColor.new("Black")
  352. surfaceChange(p27)
  353. local p28 = Instance.new("Part", model)
  354. p28.Name = "Part"
  355. p28.Size = Vector3.new(0.339700907, 0.200000003, 0.200000003)
  356. p28.CFrame = CFrame.new(-10.1629801, 1.31906176, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
  357. p28.Anchored = false
  358. p28.CanCollide = false
  359. p28.BrickColor = BrickColor.new("Black")
  360. surfaceChange(p28)
  361. local p29 = Instance.new("Part", model)
  362. p29.Name = "Main"
  363. p29.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  364. p29.CFrame = CFrame.new(-9.94953632, 1.48003721, 16.3016109, 0, -1, 1.70171716e-005, 0, 1.70171716e-005, 1, -1, 0, 0)
  365. p29.Anchored = false
  366. p29.CanCollide = false
  367. p29.BrickColor = BrickColor.new("Institutional white")
  368. surfaceChange(p29)
  369. local p30 = Instance.new("Part", model)
  370. p30.Name = "ShootTop"
  371. p30.Size = Vector3.new(1.80203247, 0.211908743, 0.3510243)
  372. p30.CFrame = CFrame.new(-10.9396744, 1.61764574, 16.3285313, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
  373. p30.Anchored = false
  374. p30.CanCollide = false
  375. p30.BrickColor = BrickColor.new("Smoky grey")
  376. surfaceChange(p30)
  377. local p31 = Instance.new("Part", model)
  378. p31.Name = "Part"
  379. p31.Size = Vector3.new(0.200000003, 0.200000003, 0.244261131)
  380. p31.CFrame = CFrame.new(-10.0182848, 1.47841287, 16.2991848, 1, 1.70171716e-005, 0, -1.70171716e-005, 1, 0, 0, 0, 1)
  381. p31.Anchored = false
  382. p31.CanCollide = false
  383. p31.BrickColor = BrickColor.new("Black")
  384. surfaceChange(p31)
  385.  
  386. scan(model)
  387. weldModel(model, model.Handle)
  388. weldModel(mag, model.Handle)
  389. return model
  390. end
  391.  
  392.  
  393. function activated()
  394. local gun = createPistol()
  395. gun.PrimaryPart = gun.Handle
  396. gun:SetPrimaryPartCFrame(rightArm.CFrame*cf(0, -1, 0)*angles(0, rad(90), 0)*fangles(0, 0, rad(-90)))
  397. weldBetween(gun.PrimaryPart, rightArm)
  398.  
  399. local gun2 = createPistol()
  400. gun2.PrimaryPart = gun2.Handle
  401. gun2:SetPrimaryPartCFrame(leftArm.CFrame*cf(0, -1, 0)*angles(0, rad(90), 0)*fangles(0,0,rad(-90)))
  402. weldBetween(gun2.PrimaryPart, leftArm)
  403. return gun, gun2
  404. end
  405.  
  406. local g1, g2 = nil, nil
  407.  
  408. local ac = false
  409.  
  410. local cu = true
  411.  
  412. mouse.KeyDown:connect(function(key)
  413. if key:lower() == "f" then
  414. if not ac then
  415. g1, g2 = activated()
  416. rightArmJoint.Part0 = rightArm
  417. leftArmJoint.Part0 = leftArm
  418. rightArmTargetCF = rightArmHoldCF
  419. leftArmTargetCF = leftArmHoldCF
  420. ac = true
  421. else
  422. currentSide = 1
  423. rightArmTargetCF = rightArmOriginCF
  424. leftArmTargetCF = leftArmOriginCF
  425. wait(0.2)
  426. g1:Destroy()
  427. g2:Destroy()
  428. g1, g2 = nil, nil
  429. rightArmJoint.Part0 = nil
  430. leftArmJoint.Part0 = nil
  431. ac = false
  432. end
  433. elseif key:lower() == "q" then
  434. if ac and cu then
  435. cu = false
  436. rightArmTargetCF = rightArmHoldCF*angles(rad(0),0,rad(-30))*cf(-0.3,0.5,0)
  437. leftArmTargetCF = leftArmHoldCF*angles(0,0,rad(30))*cf(0.3,0.5,0)
  438. for i = 1,20, 1 do
  439. wait()
  440. if currentSide == 1 then
  441. rightArmTargetCF = rightArmHoldCF*angles(rad(0),0,rad(-30))*cf(-0.3,0.5,-0.5)
  442. local hit = mouse.hit.p
  443. local ray = Ray.new(g1.Main.Position, (mouse.hit.p - g1.Main.Position).unit*500)
  444. local hit,pos = workspace:FindPartOnRay(ray, char)
  445. local dist = (mouse.hit.p - g1.Main.Position).magnitude
  446. local l1 = Instance.new("Part", workspace)
  447. game.Debris:AddItem(l1, 0.3)
  448. surfaceChange(l1)
  449. l1.Size = Vector3.new(0.2,0.2,dist)
  450. l1.CFrame = CFrame.new(g1.Main.Position, mouse.hit.p)
  451. l1.CFrame = l1.CFrame*CFrame.new(0,0,-dist/2)
  452. l1.Transparency = 0.5
  453. l1.BrickColor = BrickColor.new("Really red")
  454. l1.Anchored = true
  455. l1.CanCollide = false
  456. if hit ~= nil then
  457. if hit.Parent:FindFirstChild("Humanoid") then
  458. hit.Parent.Humanoid:TakeDamage(30)
  459. end
  460. end
  461. currentSide = 2
  462. else
  463. leftArmTargetCF = leftArmHoldCF*angles(rad(0),0,rad(30))*cf(0.3,0.5,-0.5)
  464. local hit = mouse.hit.p
  465. local ray = Ray.new(g2.Main.Position, (mouse.hit.p - g2.Main.Position).unit*500)
  466. local hit,pos = workspace:FindPartOnRay(ray, char)
  467. local dist = (mouse.hit.p - g2.Main.Position).magnitude
  468. local l1 = Instance.new("Part", workspace)
  469. game.Debris:AddItem(l1, 0.3)
  470. surfaceChange(l1)
  471. l1.Size = Vector3.new(0.2,0.2,dist)
  472. l1.CFrame = CFrame.new(g2.Main.Position, mouse.hit.p)
  473. l1.CFrame = l1.CFrame*CFrame.new(0,0,-dist/2)
  474. l1.Transparency = 0.5
  475. l1.BrickColor = BrickColor.new("Really red")
  476. l1.Anchored = true
  477. l1.CanCollide = false
  478. if hit ~= nil then
  479. if hit.Parent:FindFirstChild("Humanoid") then
  480. hit.Parent.Humanoid:TakeDamage(30)
  481. end
  482. end
  483. currentSide = 1
  484. end
  485. wait(0.1)
  486. rightArmTargetCF = rightArmHoldCF*angles(rad(0),0,rad(-30))*cf(-0.3,0.5,0)
  487. leftArmTargetCF = leftArmHoldCF*angles(0,0,rad(30))*cf(0.3,0.5,0)
  488. end
  489. wait(0.2)
  490. rightArmTargetCF = rightArmHoldCF
  491. leftArmTargetCF = leftArmHoldCF
  492. cu = true
  493. end
  494. end
  495. end)
  496.  
  497. mouse.Button1Down:connect(function()
  498. if ac and cu then
  499. if g1 ~= nil and g2 ~= nil then
  500. if currentSide == 1 then
  501. local ray1 = Ray.new(g1.Main.Position, (mouse.hit.p - g1.Main.Position).unit*500)
  502. local hit,pos = workspace:FindPartOnRay(ray1, char)
  503. local dist = (mouse.hit.p - g1.Main.Position).magnitude
  504. rightArmTargetCF = rightArmHoldCF*angles(rad(-30),0,0)
  505. local l1 = Instance.new("Part", workspace)
  506. game.Debris:AddItem(l1, 0.3)
  507. surfaceChange(l1)
  508. l1.Size = Vector3.new(0.2,0.2,dist)
  509. l1.CFrame = CFrame.new(g1.Main.Position, mouse.hit.p)
  510. l1.CFrame = l1.CFrame*CFrame.new(0,0,-dist/2)
  511. l1.Transparency = 0.5
  512. l1.BrickColor = BrickColor.new("Really red")
  513. l1.Anchored = true
  514. l1.CanCollide = false
  515. if hit ~= nil then
  516. if hit.Parent:FindFirstChild("Humanoid") then
  517. hit.Parent.Humanoid:TakeDamage(20)
  518. end
  519. end
  520. currentSide = 2
  521. wait(0.2)
  522. rightArmTargetCF = rightArmHoldCF
  523. else
  524. local ray1 = Ray.new(g2.Main.Position, (mouse.hit.p - g2.Main.Position).unit*500)
  525. local hit,pos = workspace:FindPartOnRay(ray1, char)
  526. local dist = (mouse.hit.p - g2.Main.Position).magnitude
  527. leftArmTargetCF = leftArmHoldCF*angles(rad(-30),0,0)
  528. local l1 = Instance.new("Part", workspace)
  529. game.Debris:AddItem(l1, 0.3)
  530. surfaceChange(l1)
  531. l1.Size = Vector3.new(0.2,0.2,dist)
  532. l1.CFrame = CFrame.new(g2.Main.Position, mouse.hit.p)
  533. l1.CFrame = l1.CFrame*CFrame.new(0,0,-dist/2)
  534. l1.Transparency = 0.5
  535. l1.BrickColor = BrickColor.new("Really red")
  536. l1.Anchored = true
  537. l1.CanCollide = false
  538. if hit ~= nil then
  539. if hit.Parent:FindFirstChild("Humanoid") then
  540. hit.Parent.Humanoid:TakeDamage(20)
  541. end
  542. end
  543. currentSide = 1
  544. wait(0.2)
  545. leftArmTargetCF = leftArmHoldCF
  546. end
  547. end
  548. end
  549. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement