Advertisement
Roblox_Xploits

merfd

Nov 5th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.76 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Model0 = Instance.new("Model")
  20. Model1 = Instance.new("Model")
  21. Part2 = Instance.new("Part")
  22. CylinderMesh3 = Instance.new("CylinderMesh")
  23. Sound4 = Instance.new("Sound")
  24. Sound5 = Instance.new("Sound")
  25. Sound6 = Instance.new("Sound")
  26. Model7 = Instance.new("Model")
  27. Part8 = Instance.new("Part")
  28. PointLight9 = Instance.new("PointLight")
  29. Part10 = Instance.new("Part")
  30. PointLight11 = Instance.new("PointLight")
  31. Part12 = Instance.new("Part")
  32. CylinderMesh13 = Instance.new("CylinderMesh")
  33. Part14 = Instance.new("Part")
  34. CylinderMesh15 = Instance.new("CylinderMesh")
  35. Part16 = Instance.new("Part")
  36. CylinderMesh17 = Instance.new("CylinderMesh")
  37. Part18 = Instance.new("Part")
  38. Part19 = Instance.new("Part")
  39. CylinderMesh20 = Instance.new("CylinderMesh")
  40. Part21 = Instance.new("Part")
  41. CylinderMesh22 = Instance.new("CylinderMesh")
  42. Part23 = Instance.new("Part")
  43. CylinderMesh24 = Instance.new("CylinderMesh")
  44. Part25 = Instance.new("Part")
  45. CylinderMesh26 = Instance.new("CylinderMesh")
  46. Script27 = Instance.new("Script")
  47. Part28 = Instance.new("Part")
  48. Model0.Name = "Turret"
  49. Model0.Parent = mas
  50. Model1.Name = "Base"
  51. Model1.Parent = Model0
  52. Model1.PrimaryPart = Part2
  53. Part2.Name = "Rotor"
  54. Part2.Parent = Model1
  55. Part2.Material = Enum.Material.DiamondPlate
  56. Part2.BrickColor = BrickColor.new("Dark stone grey")
  57. Part2.Rotation = Vector3.new(-180, 0, 0)
  58. Part2.Anchored = true
  59. Part2.FormFactor = Enum.FormFactor.Custom
  60. Part2.Size = Vector3.new(1.80000007, 0.200000003, 1.79999995)
  61. Part2.CFrame = CFrame.new(1.28499699, 5.99133778, -124.175003, 1, 0, 1.19248806e-08, 0, -1, 0, 1.19248806e-08, 0, -1)
  62. Part2.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  63. Part2.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  64. Part2.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  65. Part2.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  66. Part2.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  67. Part2.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  68. Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  69. Part2.Position = Vector3.new(1.28499699, 5.99133778, -124.175003)
  70. Part2.Orientation = Vector3.new(0, 180, 180)
  71. Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  72. CylinderMesh3.Parent = Part2
  73. Sound4.Name = "Launch"
  74. Sound4.Parent = Part2
  75. Sound4.SoundId = "rbxassetid://275560598"
  76. Sound4.Volume = 1
  77. Sound5.Name = "Locked"
  78. Sound5.Parent = Part2
  79. Sound5.SoundId = "http://www.roblox.com/asset/?id=103879773"
  80. Sound5.Volume = 0.10000000149012
  81. Sound5.Looped = true
  82. Sound6.Name = "Locking"
  83. Sound6.Parent = Part2
  84. Sound6.SoundId = "http://www.roblox.com/asset/?id=103825932"
  85. Sound6.Volume = 0.10000000149012
  86. Sound6.Looped = true
  87. Model7.Name = "Turret"
  88. Model7.Parent = Model1
  89. Model7.PrimaryPart = Part18
  90. Part8.Name = "Gun"
  91. Part8.Parent = Model7
  92. Part8.Material = Enum.Material.SmoothPlastic
  93. Part8.BrickColor = BrickColor.new("Artichoke")
  94. Part8.Transparency = 1
  95. Part8.Rotation = Vector3.new(-180, 0, 0)
  96. Part8.Anchored = true
  97. Part8.FormFactor = Enum.FormFactor.Custom
  98. Part8.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  99. Part8.CFrame = CFrame.new(1.33499801, 4.89133406, -122.975006, 1, 4.37113883e-08, -4.37113883e-08, 4.37113883e-08, -1, 1.19248806e-08, -4.37113883e-08, -1.19248824e-08, -1)
  100. Part8.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  101. Part8.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  102. Part8.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  103. Part8.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  104. Part8.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  105. Part8.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  106. Part8.Color = Color3.new(0.541176, 0.670588, 0.521569)
  107. Part8.Position = Vector3.new(1.33499801, 4.89133406, -122.975006)
  108. Part8.Orientation = Vector3.new(0, -180, 180)
  109. Part8.Color = Color3.new(0.541176, 0.670588, 0.521569)
  110. PointLight9.Name = "Muzzle"
  111. PointLight9.Parent = Part8
  112. PointLight9.Color = Color3.new(1, 0.666667, 0)
  113. PointLight9.Enabled = false
  114. PointLight9.Brightness = 0.5
  115. PointLight9.Range = 12
  116. PointLight9.Shadows = true
  117. PointLight9.Color = Color3.new(1, 0.666667, 0)
  118. Part10.Name = "Gun"
  119. Part10.Parent = Model7
  120. Part10.Material = Enum.Material.SmoothPlastic
  121. Part10.BrickColor = BrickColor.new("Artichoke")
  122. Part10.Transparency = 1
  123. Part10.Rotation = Vector3.new(-180, 0, 0)
  124. Part10.Anchored = true
  125. Part10.FormFactor = Enum.FormFactor.Custom
  126. Part10.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  127. Part10.CFrame = CFrame.new(1.33499599, 4.89133406, -122.975006, 1, 4.37113883e-08, -4.37113883e-08, 4.37113883e-08, -1, 1.19248806e-08, -4.37113883e-08, -1.19248824e-08, -1)
  128. Part10.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  129. Part10.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  130. Part10.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  131. Part10.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  132. Part10.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  133. Part10.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  134. Part10.Color = Color3.new(0.541176, 0.670588, 0.521569)
  135. Part10.Position = Vector3.new(1.33499599, 4.89133406, -122.975006)
  136. Part10.Orientation = Vector3.new(0, -180, 180)
  137. Part10.Color = Color3.new(0.541176, 0.670588, 0.521569)
  138. PointLight11.Name = "Muzzle"
  139. PointLight11.Parent = Part10
  140. PointLight11.Color = Color3.new(1, 0.666667, 0)
  141. PointLight11.Enabled = false
  142. PointLight11.Brightness = 0.5
  143. PointLight11.Range = 12
  144. PointLight11.Shadows = true
  145. PointLight11.Color = Color3.new(1, 0.666667, 0)
  146. Part12.Parent = Model7
  147. Part12.Material = Enum.Material.Metal
  148. Part12.Rotation = Vector3.new(90, 0, -180)
  149. Part12.Anchored = true
  150. Part12.FormFactor = Enum.FormFactor.Custom
  151. Part12.Size = Vector3.new(0.25, 0.699999988, 0.200000003)
  152. Part12.CFrame = CFrame.new(1.33499599, 4.89133406, -123.350006, -1, 4.37113883e-08, 1.19248824e-08, -1.19248824e-08, 5.21253064e-16, -1, -4.37113883e-08, -1, 0)
  153. Part12.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  154. Part12.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  155. Part12.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  156. Part12.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  157. Part12.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  158. Part12.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  159. Part12.Position = Vector3.new(1.33499599, 4.89133406, -123.350006)
  160. Part12.Orientation = Vector3.new(90, 180, 0)
  161. CylinderMesh13.Parent = Part12
  162. CylinderMesh13.Scale = Vector3.new(0.5, 1, 0.5)
  163. CylinderMesh13.Scale = Vector3.new(0.5, 1, 0.5)
  164. Part14.Parent = Model7
  165. Part14.Material = Enum.Material.DiamondPlate
  166. Part14.BrickColor = BrickColor.new("Dark stone grey")
  167. Part14.Rotation = Vector3.new(90, 0, -180)
  168. Part14.Anchored = true
  169. Part14.FormFactor = Enum.FormFactor.Custom
  170. Part14.Size = Vector3.new(0.25, 0.200000003, 0.200000003)
  171. Part14.CFrame = CFrame.new(1.33499599, 4.89133406, -123.800003, -1, 4.37113883e-08, 1.19248824e-08, -1.19248824e-08, 5.21253064e-16, -1, -4.37113883e-08, -1, 0)
  172. Part14.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  173. Part14.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  174. Part14.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  175. Part14.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  176. Part14.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  177. Part14.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  178. Part14.Color = Color3.new(0.388235, 0.372549, 0.384314)
  179. Part14.Position = Vector3.new(1.33499599, 4.89133406, -123.800003)
  180. Part14.Orientation = Vector3.new(90, 180, 0)
  181. Part14.Color = Color3.new(0.388235, 0.372549, 0.384314)
  182. CylinderMesh15.Parent = Part14
  183. Part16.Parent = Model7
  184. Part16.Material = Enum.Material.DiamondPlate
  185. Part16.BrickColor = BrickColor.new("Dark stone grey")
  186. Part16.Rotation = Vector3.new(90, 0, 90)
  187. Part16.Anchored = true
  188. Part16.FormFactor = Enum.FormFactor.Custom
  189. Part16.Size = Vector3.new(0.699999988, 0.599999905, 0.699999988)
  190. Part16.CFrame = CFrame.new(1.13499606, 4.89133406, -124.175003, 0, -1, 1.19248824e-08, 0, -1.19248824e-08, -1, 1, 0, 0)
  191. Part16.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  192. Part16.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  193. Part16.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  194. Part16.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  195. Part16.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  196. Part16.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  197. Part16.Color = Color3.new(0.388235, 0.372549, 0.384314)
  198. Part16.Position = Vector3.new(1.13499606, 4.89133406, -124.175003)
  199. Part16.Orientation = Vector3.new(90, -90, 0)
  200. Part16.Color = Color3.new(0.388235, 0.372549, 0.384314)
  201. CylinderMesh17.Parent = Part16
  202. Part18.Name = "Rotor"
  203. Part18.Parent = Model7
  204. Part18.Material = Enum.Material.SmoothPlastic
  205. Part18.BrickColor = BrickColor.new("Artichoke")
  206. Part18.Transparency = 1
  207. Part18.Rotation = Vector3.new(-180, 0, 0)
  208. Part18.Anchored = true
  209. Part18.FormFactor = Enum.FormFactor.Custom
  210. Part18.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  211. Part18.CFrame = CFrame.new(1.28499699, 4.89133406, -124.175003, 1, 4.37113883e-08, -4.37113883e-08, 4.37113883e-08, -1, 1.19248806e-08, -4.37113883e-08, -1.19248824e-08, -1)
  212. Part18.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  213. Part18.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  214. Part18.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  215. Part18.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  216. Part18.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  217. Part18.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  218. Part18.Color = Color3.new(0.541176, 0.670588, 0.521569)
  219. Part18.Position = Vector3.new(1.28499699, 4.89133406, -124.175003)
  220. Part18.Orientation = Vector3.new(0, -180, 180)
  221. Part18.Color = Color3.new(0.541176, 0.670588, 0.521569)
  222. Part19.Parent = Model7
  223. Part19.Material = Enum.Material.Metal
  224. Part19.Rotation = Vector3.new(-88.4300003, 32.3600006, 179.159988)
  225. Part19.Anchored = true
  226. Part19.FormFactor = Enum.FormFactor.Plate
  227. Part19.Size = Vector3.new(1.20000005, 0.100000001, 1.20000005)
  228. Part19.CFrame = CFrame.new(0.975300014, 4.93038607, -123.912231, -0.844599128, -0.0123738181, 0.535251737, 0.535393536, -0.019519804, 0.844374418, -1.43866487e-07, 0.999732375, 0.0231113452)
  229. Part19.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  230. Part19.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  231. Part19.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  232. Part19.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  233. Part19.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  234. Part19.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  235. Part19.Position = Vector3.new(0.975300014, 4.93038607, -123.912231)
  236. Part19.Orientation = Vector3.new(-57.5999985, 87.5299988, 92.0899963)
  237. CylinderMesh20.Parent = Part19
  238. CylinderMesh20.Scale = Vector3.new(0.280000001, 1, 0.280000001)
  239. CylinderMesh20.Scale = Vector3.new(0.280000001, 1, 0.280000001)
  240. Part21.Parent = Model7
  241. Part21.Material = Enum.Material.Metal
  242. Part21.Rotation = Vector3.new(-88.4300003, 32.3600006, 179.159988)
  243. Part21.Anchored = true
  244. Part21.FormFactor = Enum.FormFactor.Plate
  245. Part21.Size = Vector3.new(1, 0.200000003, 1)
  246. Part21.CFrame = CFrame.new(0.974668026, 4.92942286, -123.862244, -0.844599128, -0.0123738181, 0.535251737, 0.535393536, -0.019519804, 0.844374418, -1.43866487e-07, 0.999732375, 0.0231113452)
  247. Part21.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  248. Part21.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  249. Part21.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  250. Part21.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  251. Part21.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  252. Part21.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  253. Part21.Position = Vector3.new(0.974668026, 4.92942286, -123.862244)
  254. Part21.Orientation = Vector3.new(-57.5999985, 87.5299988, 92.0899963)
  255. CylinderMesh22.Parent = Part21
  256. CylinderMesh22.Scale = Vector3.new(0.280000001, 1, 0.280000001)
  257. CylinderMesh22.Scale = Vector3.new(0.280000001, 1, 0.280000001)
  258. Part23.Parent = Model7
  259. Part23.Material = Enum.Material.Neon
  260. Part23.BrickColor = BrickColor.new("Maroon")
  261. Part23.Transparency = 0.5
  262. Part23.Rotation = Vector3.new(-88.4300003, 32.3600006, 179.159988)
  263. Part23.Anchored = true
  264. Part23.CanCollide = false
  265. Part23.FormFactor = Enum.FormFactor.Plate
  266. Part23.Size = Vector3.new(0.100000001, 249.100021, 0.100000001)
  267. Part23.CFrame = CFrame.new(-0.565246999, 2.50018311, 0.554248989, -0.844599128, -0.0123738181, 0.535251737, 0.535393536, -0.019519804, 0.844374418, -1.43866487e-07, 0.999732375, 0.0231113452)
  268. Part23.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  269. Part23.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  270. Part23.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  271. Part23.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  272. Part23.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  273. Part23.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  274. Part23.Color = Color3.new(0.458824, 0, 0)
  275. Part23.Position = Vector3.new(-0.565246999, 2.50018311, 0.554248989)
  276. Part23.Orientation = Vector3.new(-57.5999985, 87.5299988, 92.0899963)
  277. Part23.Color = Color3.new(0.458824, 0, 0)
  278. CylinderMesh24.Parent = Part23
  279. CylinderMesh24.Scale = Vector3.new(0.280000001, 1, 0.280000001)
  280. CylinderMesh24.Scale = Vector3.new(0.280000001, 1, 0.280000001)
  281. Part25.Parent = Model7
  282. Part25.Material = Enum.Material.Metal
  283. Part25.Rotation = Vector3.new(90, 0, -180)
  284. Part25.Anchored = true
  285. Part25.FormFactor = Enum.FormFactor.Custom
  286. Part25.Size = Vector3.new(0.449999988, 0.400000006, 0.300000012)
  287. Part25.CFrame = CFrame.new(1.33499599, 4.89133406, -123.550003, -1, 4.37113883e-08, 1.19248824e-08, -1.19248824e-08, 5.21253064e-16, -1, -4.37113883e-08, -1, 0)
  288. Part25.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  289. Part25.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  290. Part25.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  291. Part25.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  292. Part25.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  293. Part25.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  294. Part25.Position = Vector3.new(1.33499599, 4.89133406, -123.550003)
  295. Part25.Orientation = Vector3.new(90, 180, 0)
  296. CylinderMesh26.Parent = Part25
  297. CylinderMesh26.Scale = Vector3.new(0.5, 1, 0.5)
  298. CylinderMesh26.Scale = Vector3.new(0.5, 1, 0.5)
  299. Script27.Name = "Mastery"
  300. Script27.Parent = Model0
  301. table.insert(cors,sandbox(Script27,function()
  302. sp = script.Parent
  303. r = game:GetService('RunService')
  304.  
  305. Objs = {
  306. base = sp:WaitForChild('Base'),
  307. turret = sp.Base:WaitForChild('Turret'),
  308. }
  309.  
  310. Set = {
  311. ExplosionRadius = 3,
  312. Damage = 5,
  313. Cooldown = 0.25,
  314. MaximumRange = 200,
  315. MinimumRange = 2,
  316. LockOnTime = 1.5,
  317. TeamColor = BrickColor.new ('Toothpaste'),
  318. Groups = {},
  319. UserIds = {},
  320. Spread = 1,
  321. }
  322.  
  323. Var = {
  324. Target = nil,
  325. FirstLock = 0,
  326. RequiredLock = nil,
  327. }
  328.  
  329. Sounds = {
  330. launch = Objs.base.PrimaryPart:WaitForChild('Launch'),
  331. locking = Objs.base.PrimaryPart:WaitForChild('Locking'),
  332. locked = Objs.base.PrimaryPart:WaitForChild('Locked'),
  333. }
  334.  
  335. function castray(cframeFirst, cframeSecond, ignoreObject, distanceToCast)
  336. local newRay = Ray.new(cframeFirst.p, (cframeSecond.p - cframeFirst.p).unit * distanceToCast)
  337. local hitObject, positionHit = workspace:FindPartOnRay(newRay, ignoreObject)
  338. return positionHit, hitObject
  339. end
  340.  
  341. function Find(t,item,mode)
  342. if mode == 'userid' then
  343. for i,name in pairs (t) do
  344. if name == item then
  345. return true
  346. end
  347. end
  348. elseif mode == 'group' then
  349. for i,id in pairs (t) do
  350. if item:GetRankInGroup(id) > 0 then
  351. return true
  352. end
  353. end
  354. end
  355. return false
  356. end
  357.  
  358. function Fire(CFrame1,CFrame2)
  359. Sounds.launch:Play()
  360. local ray = Instance.new('Part',workspace)
  361. game:GetService('Debris'):AddItem(ray,0.1)
  362. ray.FormFactor = Enum.FormFactor.Custom
  363. ray.TopSurface = 0
  364. ray.BottomSurface = 0
  365. ray.Anchored = true
  366. ray.CanCollide = false
  367. ray.Material = Enum.Material.Neon
  368. ray.BrickColor = BrickColor.new('Gold')
  369. ray.Size = Vector3.new(0.2,(CFrame1.p - CFrame2.p).magnitude,0.2)
  370. ray.CFrame = CFrame.new((CFrame1.p + CFrame2.p)/2,CFrame1.p) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
  371. local mesh = Instance.new('CylinderMesh',ray)
  372. mesh.Scale = Vector3.new(0.25,1,0.25)
  373. end
  374.  
  375. function Explode(pos)
  376. for i,v in pairs (game.Players:GetPlayers()) do
  377. if v.TeamColor ~= Set.TeamColor then
  378. if v:DistanceFromCharacter (pos) <= Set.ExplosionRadius then
  379. v.Character.Humanoid:TakeDamage(Set.Damage)
  380. end
  381. end
  382. end
  383. end
  384.  
  385. function CheckTarget(player)
  386. if player.TeamColor ~= Set.TeamColor or Find(Set.UserIds,player.Name,'userid') == true or Find(Set.Groups,player,'group') == true then
  387. if player:DistanceFromCharacter(Objs.turret.PrimaryPart.Position) <= Set.MaximumRange then
  388. if player:DistanceFromCharacter(Objs.turret.PrimaryPart.Position) >= Set.MinimumRange then
  389. if player.Character.Humanoid.Health > 0 then
  390. local pos, hit = castray(Objs.turret.Gun.CFrame, player.Character.Torso.CFrame, Objs.turret, Set.MaximumRange)
  391. if (pos - player.Character.Torso.Position).magnitude <= Set.ExplosionRadius then
  392. return true
  393. end
  394. end
  395. end
  396. end
  397. end
  398. return false
  399. end
  400.  
  401. function AquireTarget()
  402. local targets = {}
  403. for i,player in pairs (game.Players:GetPlayers()) do
  404. if CheckTarget(player) == true then
  405. table.insert(targets,player.Character)
  406. end
  407. end
  408. if #targets > 0 then
  409. Var.Target = targets[math.random(1,#targets)]
  410. else
  411. Var.Target = nil
  412. end
  413. end
  414.  
  415. r.Stepped:connect(function()
  416. if Var.Target ~= nil then
  417. local direction = Objs.base.PrimaryPart.CFrame:pointToObjectSpace(Var.Target.Torso.Position)
  418. local direction2 = Objs.turret.PrimaryPart.CFrame:pointToObjectSpace(Var.Target.Torso.Position)
  419. local spiny = math.atan2(direction.x, direction.z) + math.pi
  420. local spinx = math.atan2(direction2.y,direction.y)
  421. Objs.base:SetPrimaryPartCFrame(Objs.base.PrimaryPart.CFrame * CFrame.Angles(0, spiny, 0))
  422. Objs.turret:SetPrimaryPartCFrame(Objs.turret.PrimaryPart.CFrame * CFrame.Angles(math.rad(spinx), 0, 0))
  423. end
  424. end)
  425.  
  426. spawn(function()
  427. while r.Stepped:wait() do
  428. if Var.Target == nil then
  429. for i,sound in pairs (Sounds) do
  430. if i ~= 'turn' and i ~= 'launch' then
  431. if sound.IsPlaying == true then sound:Stop() end
  432. wait()
  433. end
  434. end
  435. AquireTarget()
  436. else
  437. if Var.RequiredLock == nil then
  438. Var.RequiredLock = tick() + Set.LockOnTime
  439. end
  440. Var.FirstLock = tick()
  441. if Sounds.locking.IsPlaying == false then Sounds.locking:Play() end
  442. if Var.FirstLock > Var.RequiredLock then
  443. Sounds.locking:Stop()
  444. if Sounds.locked.IsPlaying == false then Sounds.locked:Play() end
  445. Var.RequiredLock = nil
  446. Var.FirstLock = 0
  447. while sp and wait(Set.Cooldown) and Var.Target ~= nil and CheckTarget(game.Players:GetPlayerFromCharacter(Var.Target)) == true do
  448. for i,gun in pairs (Objs.turret:GetChildren()) do
  449. if gun.Name == 'Gun' then
  450. local pos, hit = castray(gun.CFrame, Var.Target.Torso.CFrame, Objs.turret, Set.MaximumRange)
  451. gun.Muzzle.Enabled = true
  452. local spread = CFrame.new(math.random(-Set.Spread,Set.Spread),math.random(-Set.Spread,Set.Spread),math.random(-Set.Spread,Set.Spread))
  453. local tpos = CFrame.new(pos) * spread
  454. Fire(gun.CFrame,tpos)
  455. Explode(tpos.p)
  456. gun.Muzzle.Enabled = false
  457. wait()
  458. end
  459. end
  460. end
  461. Sounds.locked:Stop()
  462. Var.Target = nil
  463. end
  464. end
  465. end
  466. end)
  467. end))
  468. Part28.Name = "Baseplate"
  469. Part28.Parent = mas
  470. Part28.BrickColor = BrickColor.new("Dark stone grey")
  471. Part28.Anchored = true
  472. Part28.Locked = true
  473. Part28.FormFactor = Enum.FormFactor.Symmetric
  474. Part28.Size = Vector3.new(512, 20, 512)
  475. Part28.CFrame = CFrame.new(0, -10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  476. Part28.Color = Color3.new(0.388235, 0.372549, 0.384314)
  477. Part28.Position = Vector3.new(0, -10, 0)
  478. Part28.Color = Color3.new(0.388235, 0.372549, 0.384314)
  479. for i,v in pairs(mas:GetChildren()) do
  480. v.Parent = workspace
  481. pcall(function() v:MakeJoints() end)
  482. end
  483. mas:Destroy()
  484. for i,v in pairs(cors) do
  485. spawn(function()
  486. pcall(v)
  487. end)
  488. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement