Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. mainyy = workspace.Base.Position
  2.  
  3. for i=1, 10 do
  4.  
  5. mainplace = mainyy + Vector3.new(math.random(-120,120),0.3,math.random(-120,120))
  6.  
  7. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor)
  8. part.Parent = parent
  9. part.formFactor = 0
  10. part.CanCollide = collide
  11. part.Transparency = tran
  12. part.Reflectance = ref
  13. part.Size = Vector3.new(x,y,z)
  14. part.BrickColor = BrickColor.new(color)
  15. part.TopSurface = 0
  16. part.BottomSurface = 0
  17. part.Anchored = anchor
  18. part:BreakJoints()
  19. end
  20.  
  21. function weld(w, p, p0, p1, a, b, c, x, y, z)
  22. w.Parent = p
  23. w.Part0 = p0
  24. w.Part1 = p1
  25. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  26. end
  27.  
  28. function mesh(mesh, parent, x, y, z, type)
  29. mesh.Parent = parent
  30. mesh.Scale = Vector3.new(x, y, z)
  31. mesh.MeshType = type
  32. end
  33.  
  34. local turret = Instance.new("Model",workspace)
  35. turret.Name = "Turret"
  36.  
  37. local main = Instance.new("Part")
  38. prop(main, turret, true, 0, 0, 3, 1, 3, "Dark grey", true)
  39. main.CFrame = CFrame.new(mainplace)
  40. mainmesh = Instance.new("CylinderMesh",main)
  41.  
  42. local neck = Instance.new("Part")
  43. prop(neck,turret,true,0,0,1,2,1,"Dark grey", true)
  44. neck.CFrame = CFrame.new(mainplace) * CFrame.new(0,1.1,0)
  45. neckmesh = Instance.new("CylinderMesh",neck)
  46. neckmesh.Scale = Vector3.new(1,1.5,1)
  47.  
  48. local move = Instance.new("Part")
  49. prop(move, turret, false, 0, 0, 1, 1, 5,"Dark grey", false)
  50. move.CFrame = CFrame.new(mainplace) * CFrame.new(0,3,0)
  51.  
  52. local bg = Instance.new("BodyGyro")
  53. bg.Parent = move
  54. bg.maxTorque = Vector3.new(1e+008,1e+008,1e+008)
  55.  
  56. local bp = Instance.new("BodyPosition",move)
  57. bp.maxForce = Vector3.new(1e+008,1e+008,1e+008)
  58. bp.position = bp.Parent.Position
  59.  
  60. local gunner = Instance.new("Part")
  61. gunner.FrontSurface = "Hinge"
  62. prop(gunner,turret,true,0,0,1,1,1,"Dark grey",false)
  63. gunner.CFrame = CFrame.new(mainplace) * CFrame.new(0,3,2.5)
  64.  
  65. local gunweld = Instance.new("Weld")
  66. weld(gunweld,move,move,gunner,0,0,0,0,0,2.5)
  67.  
  68. local sound = Instance.new("Sound",gunner)
  69. sound.Volume = 0.8
  70. sound.Pitch = 4
  71. sound.SoundId = "http://www.roblox.com/asset/?id=2760979"
  72.  
  73. function find(pos)
  74. local list = game.Workspace:children()
  75. local torso = nil
  76. local dist = 35
  77. local temp = nil
  78. local human = nil
  79. local temp2 = nil
  80. for x = 1, #list do
  81. temp2 = list[x]
  82. if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  83. temp = temp2:findFirstChild("Torso")
  84. human = temp2:findFirstChild("Humanoid")
  85. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  86. if (temp.Position - pos).magnitude < dist then
  87. torso = temp
  88. dist = (temp.Position - pos).magnitude
  89. end
  90. end
  91. end
  92. end
  93. return torso
  94. end
  95.  
  96. coroutine.resume(coroutine.create(function()
  97. while true do
  98. wait(0.1)
  99. local target = find(gunner.Position)
  100. if target ~= nil then
  101. bg.cframe = CFrame.new(move.Position, target.Position)
  102. local meh = math.random(1,8)
  103. if meh == 1 then
  104. local bulls = {}
  105. local dis = (gunner.Position - target.Position).magnitude
  106. local bullet = Instance.new("Part")
  107. prop(bullet,workspace,false,0,0,1,1,1,"Bright yellow",true)
  108. bullet.CFrame = CFrame.new(gunner.Position, target.Position) * CFrame.new(0,0,-dis/2)
  109. local meu = Instance.new("SpecialMesh")
  110. mesh(meu,bullet,0.23,0.23,dis,"Brick")
  111. local huo = target.Parent:findFirstChild("Humanoid")
  112. huo:TakeDamage(math.random(huo.MaxHealth/50,huo.MaxHealth/13))
  113. local randompitch = math.random(500,1200)/1000
  114. sound.Pitch = randompitch
  115. sound:play()
  116. table.insert(bulls,bullet)
  117. for i=1, math.random(3,6) do
  118. local msi = math.random(8,23)/10
  119. local th = Instance.new("Part")
  120. prop(th,workspace,false,0,0,1,1,1,"Bright yellow",true)
  121. th.CFrame = CFrame.new(gunner.Position,target.Position) * CFrame.new(0,0,-dis)
  122. th.CFrame = th.CFrame * CFrame.Angles(math.random(-100,100),math.random(-100,100),math.random(-100,100))
  123. th.CFrame = th.CFrame * CFrame.new(0,0,-msi/2)
  124. thme = Instance.new("SpecialMesh")
  125. mesh(thme,th,0.13,0.13,msi, "Brick")
  126. table.insert(bulls,th)
  127. for duh=1, math.random(2,5) do
  128. local bag = math.random(5,18)/10
  129. local bah = Instance.new("Part")
  130. prop(bah,workspace,false,0,0,1,1,1,"Bright yellow",true)
  131. bah.CFrame = CFrame.new(th.Position) * CFrame.new(0,0,msi/2)
  132. bah.CFrame = bah.CFrame * CFrame.Angles(math.random(-100,100),math.random(-100,100),math.random(-100,100))
  133. bah.CFrame = bah.CFrame * CFrame.new(0,0,-bag/2)
  134. bahme = Instance.new("SpecialMesh")
  135. mesh(bahme,bah,0.02,0.02,bag, "Brick")
  136. table.insert(bulls,bah)
  137. end
  138. end
  139. coroutine.resume(coroutine.create(function()
  140. for i=1, #bulls do
  141. coroutine.resume(coroutine.create(function()
  142. wait(0.1)
  143. for k=0, 1, 0.25 do
  144. wait()
  145. bulls[i].Transparency = k
  146. end
  147. bulls[i]:remove()
  148. end))
  149. end
  150. end))
  151. end
  152. end
  153. end
  154. end))
  155. end
  156.  
  157. me = game.Players.JerryMahoney
  158.  
  159. me.Chatted:connect(function(msg)
  160. if msg == "rem" then
  161. script:remove()
  162. end
  163. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement