Advertisement
firebudgy

Untitled

Jan 24th, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 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. Part0 = Instance.new("Part")
  20. Script1 = Instance.new("Script")
  21. Script2 = Instance.new("Script")
  22. BodyForce3 = Instance.new("BodyForce")
  23. Part0.Name = "Virus"
  24. Part0.Parent = mas
  25. Part0.BrickColor = BrickColor.new("Magenta")
  26. Part0.Reflectance = 0.30000001192093
  27. Part0.FormFactor = Enum.FormFactor.Symmetric
  28. Part0.Shape = Enum.PartType.Ball
  29. Part0.Size = Vector3.new(1, 1, 1)
  30. Part0.CFrame = CFrame.new(-2.5, 0.5, -57.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  31. Part0.BottomSurface = Enum.SurfaceType.Smooth
  32. Part0.TopSurface = Enum.SurfaceType.Smooth
  33. Part0.Color = Color3.new(0.666667, 0, 0.666667)
  34. Part0.Position = Vector3.new(-2.5, 0.5, -57.5)
  35. Part0.Color = Color3.new(0.666667, 0, 0.666667)
  36. Script1.Name = "VirusScript"
  37. Script1.Parent = Part0
  38. table.insert(cors,sandbox(Script1,function()
  39. wait(1)
  40. coroutine.resume(coroutine.create(function()
  41. wait(15)
  42. script.Parent:Remove()
  43. end))
  44.  
  45. script.Parent.Touched:connect(function(hit)
  46. if hit == nil then return end
  47. if hit.Parent == nil or hit.Name == "Virus" or hit:FindFirstChild("InfectedScript") ~= nil then return end
  48. local s = script.InfectedScript:clone()
  49. local t = script:clone()
  50. t.Disabled = true
  51. t.Parent = s
  52. s.Disabled = false
  53. s.Parent = hit
  54. script.Parent:Remove()
  55. end)
  56.  
  57. function attack(what)
  58. while what ~= nil and what:FindFirstChild("InfectedScript") == nil and what.Parent ~= nil do
  59. script.Parent.CFrame = CFrame.new(script.Parent.Position,what.Position)
  60. script.Parent.Velocity = script.Parent.CFrame.lookVector*20
  61. wait(0.1)
  62. end
  63. GetTarget()
  64. end
  65.  
  66. function find(w)
  67. if #w:GetChildren() == 0 then return end
  68. for _,v in pairs(w:GetChildren()) do
  69. if v.Name ~= "Virus" and v:FindFirstChild("VirusScript") == nil then
  70. if v.className == "Part" then
  71. table.insert(a,v)
  72. end
  73. find(v)
  74. end
  75. end
  76. end
  77.  
  78. function GetTarget()
  79. a = {}
  80. find(game.Workspace)
  81.  
  82. if #a == 0 then script.Parent:Remove() script.Disabled = true end
  83.  
  84. min = 99999
  85. target = nil
  86.  
  87. for _,v in pairs(a) do
  88. if (script.Parent.Position-v.Position).magnitude < min and v.Name ~= "Virus" and v:FindFirstChild("InfectedScript") == nil then
  89. min = (script.Parent.Position-v.Position).magnitude
  90. target = v
  91. end
  92. end
  93.  
  94. if target == nil then script.Parent:Remove() script.Disabled = true end
  95.  
  96. attack(target)
  97. end
  98.  
  99. GetTarget()
  100.  
  101. end))
  102. Script2.Name = "InfectedScript"
  103. Script2.Parent = Script1
  104. Script2.Disabled = true
  105. table.insert(cors,sandbox(Script2,function()
  106. script.Parent.Color = Color3.new(0.6,0,0.8)
  107. wait(math.ceil(script.Parent.Size.magnitude)/2)
  108.  
  109. function find(w)
  110. if #w:GetChildren() == 0 then return end
  111. for _,v in pairs(w:GetChildren()) do
  112. if v:FindFirstChild("InfectedScript") == nil and v:FindFirstChild("VirusScript") == nil then
  113. if v.className == "Part" then
  114. table.insert(a,v)
  115. end
  116. find(v)
  117. end
  118. end
  119. end
  120.  
  121. a = {}
  122. find(game.Workspace)
  123. if #a == 0 then script.Parent:Remove() script.Disabled = true end
  124.  
  125. num = 0
  126.  
  127. for _,v in pairs(game.Workspace:GetChildren()) do
  128. if v.Name == "Virus" and v:FindFirstChild("VirusScript") ~= nil then
  129. num = num+1
  130. end
  131. end
  132.  
  133. if num < 20 then
  134. siz = math.ceil(script.Parent.Size.magnitude/6)
  135. if siz < 2 then siz = 2
  136. elseif siz > 10 then siz = 10
  137. end
  138. else
  139. siz = 1
  140. end
  141.  
  142. for i = 1, siz do
  143. local p = Instance.new("Part")
  144. p.Name = "Virus"
  145. p.Color = Color3.new(0.7,0,0.7)
  146. p.Shape = "Ball"
  147. p.Reflectance = 0.3
  148. p.BottomSurface = 0
  149. p.TopSurface = 0
  150. p.Size = Vector3.new(1,1,1)
  151. p.Velocity = Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20))
  152. p.CFrame = CFrame.new(script.Parent.Position)
  153.  
  154. local b = Instance.new("BodyForce")
  155. b.force = Vector3.new(0,p:GetMass()*186.4,0)
  156. b.Parent = p
  157.  
  158. local s = script.VirusScript:clone()
  159. s.Disabled = false
  160. s.Parent = p
  161.  
  162. p.Parent = game.Workspace
  163. end
  164.  
  165. script.Parent:Remove()
  166.  
  167. end))
  168. BodyForce3.Parent = Part0
  169. BodyForce3.force = Vector3.new(0, 97.5988159, 0)
  170. for i,v in pairs(mas:GetChildren()) do
  171. v.Parent = workspace
  172. pcall(function() v:MakeJoints() end)
  173. end
  174. mas:Destroy()
  175. for i,v in pairs(cors) do
  176. spawn(function()
  177. pcall(v)
  178. end)
  179. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement