Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Part0 = Instance.new("Part")
- Script1 = Instance.new("Script")
- Script2 = Instance.new("Script")
- BodyForce3 = Instance.new("BodyForce")
- Part0.Name = "Virus"
- Part0.Parent = mas
- Part0.BrickColor = BrickColor.new("Magenta")
- Part0.Reflectance = 0.30000001192093
- Part0.FormFactor = Enum.FormFactor.Symmetric
- Part0.Shape = Enum.PartType.Ball
- Part0.Size = Vector3.new(1, 1, 1)
- Part0.CFrame = CFrame.new(-2.5, 0.5, -57.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part0.BottomSurface = Enum.SurfaceType.Smooth
- Part0.TopSurface = Enum.SurfaceType.Smooth
- Part0.Color = Color3.new(0.666667, 0, 0.666667)
- Part0.Position = Vector3.new(-2.5, 0.5, -57.5)
- Part0.Color = Color3.new(0.666667, 0, 0.666667)
- Script1.Name = "VirusScript"
- Script1.Parent = Part0
- table.insert(cors,sandbox(Script1,function()
- wait(1)
- coroutine.resume(coroutine.create(function()
- wait(15)
- script.Parent:Remove()
- end))
- script.Parent.Touched:connect(function(hit)
- if hit == nil then return end
- if hit.Parent == nil or hit.Name == "Virus" or hit:FindFirstChild("InfectedScript") ~= nil then return end
- local s = script.InfectedScript:clone()
- local t = script:clone()
- t.Disabled = true
- t.Parent = s
- s.Disabled = false
- s.Parent = hit
- script.Parent:Remove()
- end)
- function attack(what)
- while what ~= nil and what:FindFirstChild("InfectedScript") == nil and what.Parent ~= nil do
- script.Parent.CFrame = CFrame.new(script.Parent.Position,what.Position)
- script.Parent.Velocity = script.Parent.CFrame.lookVector*20
- wait(0.1)
- end
- GetTarget()
- end
- function find(w)
- if #w:GetChildren() == 0 then return end
- for _,v in pairs(w:GetChildren()) do
- if v.Name ~= "Virus" and v:FindFirstChild("VirusScript") == nil then
- if v.className == "Part" then
- table.insert(a,v)
- end
- find(v)
- end
- end
- end
- function GetTarget()
- a = {}
- find(game.Workspace)
- if #a == 0 then script.Parent:Remove() script.Disabled = true end
- min = 99999
- target = nil
- for _,v in pairs(a) do
- if (script.Parent.Position-v.Position).magnitude < min and v.Name ~= "Virus" and v:FindFirstChild("InfectedScript") == nil then
- min = (script.Parent.Position-v.Position).magnitude
- target = v
- end
- end
- if target == nil then script.Parent:Remove() script.Disabled = true end
- attack(target)
- end
- GetTarget()
- end))
- Script2.Name = "InfectedScript"
- Script2.Parent = Script1
- Script2.Disabled = true
- table.insert(cors,sandbox(Script2,function()
- script.Parent.Color = Color3.new(0.6,0,0.8)
- wait(math.ceil(script.Parent.Size.magnitude)/2)
- function find(w)
- if #w:GetChildren() == 0 then return end
- for _,v in pairs(w:GetChildren()) do
- if v:FindFirstChild("InfectedScript") == nil and v:FindFirstChild("VirusScript") == nil then
- if v.className == "Part" then
- table.insert(a,v)
- end
- find(v)
- end
- end
- end
- a = {}
- find(game.Workspace)
- if #a == 0 then script.Parent:Remove() script.Disabled = true end
- num = 0
- for _,v in pairs(game.Workspace:GetChildren()) do
- if v.Name == "Virus" and v:FindFirstChild("VirusScript") ~= nil then
- num = num+1
- end
- end
- if num < 20 then
- siz = math.ceil(script.Parent.Size.magnitude/6)
- if siz < 2 then siz = 2
- elseif siz > 10 then siz = 10
- end
- else
- siz = 1
- end
- for i = 1, siz do
- local p = Instance.new("Part")
- p.Name = "Virus"
- p.Color = Color3.new(0.7,0,0.7)
- p.Shape = "Ball"
- p.Reflectance = 0.3
- p.BottomSurface = 0
- p.TopSurface = 0
- p.Size = Vector3.new(1,1,1)
- p.Velocity = Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20))
- p.CFrame = CFrame.new(script.Parent.Position)
- local b = Instance.new("BodyForce")
- b.force = Vector3.new(0,p:GetMass()*186.4,0)
- b.Parent = p
- local s = script.VirusScript:clone()
- s.Disabled = false
- s.Parent = p
- p.Parent = game.Workspace
- end
- script.Parent:Remove()
- end))
- BodyForce3.Parent = Part0
- BodyForce3.force = Vector3.new(0, 97.5988159, 0)
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement