SHOW:
|
|
- or go back to the newest paste.
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") |
19 | + | Model0 = Instance.new("Model") |
20 | - | Script1 = Instance.new("Script") |
20 | + | Part1 = Instance.new("Part") |
21 | Script2 = Instance.new("Script") | |
22 | - | BodyForce3 = Instance.new("BodyForce") |
22 | + | Script3 = Instance.new("Script") |
23 | - | Part0.Name = "Virus" |
23 | + | Part4 = Instance.new("Part") |
24 | - | Part0.Parent = mas |
24 | + | Script5 = Instance.new("Script") |
25 | - | Part0.BrickColor = BrickColor.new("Magenta") |
25 | + | Script6 = Instance.new("Script") |
26 | - | Part0.Reflectance = 0.30000001192093 |
26 | + | Model0.Name = "Virus" |
27 | - | Part0.FormFactor = Enum.FormFactor.Symmetric |
27 | + | Model0.Parent = mas |
28 | - | Part0.Shape = Enum.PartType.Ball |
28 | + | Part1.Name = "Virus" |
29 | - | Part0.Size = Vector3.new(1, 1, 1) |
29 | + | Part1.Parent = Model0 |
30 | - | Part0.CFrame = CFrame.new(-2.5, 0.5, -57.5, 1, 0, 0, 0, 1, 0, 0, 0, 1) |
30 | + | Part1.BrickColor = BrickColor.new("White") |
31 | - | Part0.BottomSurface = Enum.SurfaceType.Smooth |
31 | + | Part1.Reflectance = 0.30000001192093 |
32 | - | Part0.TopSurface = Enum.SurfaceType.Smooth |
32 | + | Part1.Rotation = Vector3.new(-27.9899998, 36.0999985, 27.0699997) |
33 | - | Part0.Color = Color3.new(0.666667, 0, 0.666667) |
33 | + | Part1.RotVelocity = Vector3.new(-6.34935331, 5.27814245, -3.93103671) |
34 | - | Part0.Position = Vector3.new(-2.5, 0.5, -57.5) |
34 | + | Part1.Velocity = Vector3.new(-4.65570545, -4.12282896, -6.32679892) |
35 | - | Part0.Color = Color3.new(0.666667, 0, 0.666667) |
35 | + | Part1.FormFactor = Enum.FormFactor.Symmetric |
36 | - | Script1.Name = "VirusScript" |
36 | + | Part1.Shape = Enum.PartType.Ball |
37 | - | Script1.Parent = Part0 |
37 | + | Part1.Size = Vector3.new(1, 1, 1) |
38 | - | table.insert(cors,sandbox(Script1,function() |
38 | + | Part1.CFrame = CFrame.new(-24.7388802, 0.50001502, -52.1741333, 0.719474196, -0.367776006, 0.589150012, 0.155742109, 0.912116408, 0.379193962, -0.676831782, -0.181064844, 0.713522434) |
39 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
40 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
41 | - | wait(15) |
41 | + | Part1.Color = Color3.new(0.94902, 0.952941, 0.952941) |
42 | Part1.Position = Vector3.new(-24.7388802, 0.50001502, -52.1741333) | |
43 | Part1.Orientation = Vector3.new(-22.2799988, 39.5499992, 9.68999958) | |
44 | Part1.Color = Color3.new(0.94902, 0.952941, 0.952941) | |
45 | Script2.Name = "VirusScript" | |
46 | Script2.Parent = Part1 | |
47 | table.insert(cors,sandbox(Script2,function() | |
48 | wait(1) | |
49 | coroutine.resume(coroutine.create(function() | |
50 | ||
51 | end)) | |
52 | ||
53 | script.Parent.Touched:connect(function(hit) | |
54 | if hit == nil then return end | |
55 | if hit.Parent == nil or hit.Name == "Virus" or hit:FindFirstChild("InfectedScript") ~= nil then return end | |
56 | local s = script.InfectedScript:clone() | |
57 | local t = script:clone() | |
58 | t.Disabled = true | |
59 | t.Parent = s | |
60 | s.Disabled = false | |
61 | s.Parent = hit | |
62 | script.Parent:Remove() | |
63 | end) | |
64 | ||
65 | function attack(what) | |
66 | while what ~= nil and what:FindFirstChild("InfectedScript") == nil and what.Parent ~= nil do | |
67 | script.Parent.CFrame = CFrame.new(script.Parent.Position,what.Position) | |
68 | script.Parent.Velocity = script.Parent.CFrame.lookVector*20 | |
69 | wait(0.1) | |
70 | end | |
71 | GetTarget() | |
72 | end | |
73 | ||
74 | function find(w) | |
75 | if #w:GetChildren() == 0 then return end | |
76 | for _,v in pairs(w:GetChildren()) do | |
77 | if v.Name ~= "Virus" and v:FindFirstChild("VirusScript") == nil then | |
78 | if v.className == "Part" then | |
79 | table.insert(a,v) | |
80 | end | |
81 | find(v) | |
82 | end | |
83 | end | |
84 | end | |
85 | ||
86 | function GetTarget() | |
87 | a = {} | |
88 | find(game.Workspace) | |
89 | ||
90 | if #a == 0 then script.Parent:Remove() script.Disabled = true end | |
91 | ||
92 | min = 99999 | |
93 | target = nil | |
94 | ||
95 | for _,v in pairs(a) do | |
96 | if (script.Parent.Position-v.Position).magnitude < min and v.Name ~= "Virus" and v:FindFirstChild("InfectedScript") == nil then | |
97 | min = (script.Parent.Position-v.Position).magnitude | |
98 | target = v | |
99 | end | |
100 | end | |
101 | ||
102 | - | Script2.Name = "InfectedScript" |
102 | + | |
103 | - | Script2.Parent = Script1 |
103 | + | |
104 | - | Script2.Disabled = true |
104 | + | |
105 | end | |
106 | - | script.Parent.Color = Color3.new(0.6,0,0.8) |
106 | + | |
107 | GetTarget() | |
108 | ||
109 | end)) | |
110 | Script3.Name = "InfectedScript" | |
111 | Script3.Parent = Script2 | |
112 | Script3.Disabled = true | |
113 | table.insert(cors,sandbox(Script3,function() | |
114 | script.Parent.BrickColor=BrickColor.new("White") | |
115 | wait(math.ceil(script.Parent.Size.magnitude)/2) | |
116 | ||
117 | function find(w) | |
118 | if #w:GetChildren() == 0 then return end | |
119 | for _,v in pairs(w:GetChildren()) do | |
120 | if v:FindFirstChild("InfectedScript") == nil and v:FindFirstChild("VirusScript") == nil then | |
121 | if v.className == "Part" then | |
122 | table.insert(a,v) | |
123 | end | |
124 | find(v) | |
125 | end | |
126 | end | |
127 | end | |
128 | ||
129 | a = {} | |
130 | find(game.Workspace) | |
131 | if #a == 0 then script.Parent:Remove() script.Disabled = true end | |
132 | ||
133 | num = 0 | |
134 | ||
135 | for _,v in pairs(game.Workspace:GetChildren()) do | |
136 | if v.Name == "Virus" and v:FindFirstChild("VirusScript") ~= nil then | |
137 | num = num+1 | |
138 | end | |
139 | end | |
140 | ||
141 | if num < 20 then | |
142 | siz = math.ceil(script.Parent.Size.magnitude/6) | |
143 | if siz < 2 then siz = 2 | |
144 | elseif siz > 10 then siz = 10 | |
145 | - | p.Color = Color3.new(0.7,0,0.7) |
145 | + | |
146 | else | |
147 | siz = 1 | |
148 | end | |
149 | ||
150 | for i = 1, siz do | |
151 | local p = Instance.new("Part") | |
152 | p.Name = "Virus" | |
153 | p.BrickColor=BrickColor.new("White") | |
154 | p.Shape = "Ball" | |
155 | p.Reflectance = 0.3 | |
156 | p.BottomSurface = 0 | |
157 | p.TopSurface = 0 | |
158 | p.Size = Vector3.new(1,1,1) | |
159 | p.Velocity = Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) | |
160 | p.CFrame = CFrame.new(script.Parent.Position) | |
161 | ||
162 | local b = Instance.new("BodyForce") | |
163 | b.force = Vector3.new(0,p:GetMass()*186.4,0) | |
164 | b.Parent = p | |
165 | ||
166 | local s = script.VirusScript:clone() | |
167 | s.Disabled = false | |
168 | - | BodyForce3.Parent = Part0 |
168 | + | |
169 | - | BodyForce3.force = Vector3.new(0, 97.5988159, 0) |
169 | + | |
170 | p.Parent = game.Workspace | |
171 | end | |
172 | ||
173 | script.Parent:Remove() | |
174 | ||
175 | end)) | |
176 | Part4.Name = "Virus" | |
177 | Part4.Parent = Model0 | |
178 | Part4.BrickColor = BrickColor.new("White") | |
179 | Part4.Reflectance = 0.30000001192093 | |
180 | Part4.Rotation = Vector3.new(90, 90, 0) | |
181 | Part4.FormFactor = Enum.FormFactor.Symmetric | |
182 | Part4.Shape = Enum.PartType.Ball | |
183 | Part4.Size = Vector3.new(1, 1, 1) | |
184 | Part4.CFrame = CFrame.new(-25.2599964, 1.22126997, -51.6800079, 0, 0, 1, 1, 0, 0, 0, 1, 0) | |
185 | Part4.BottomSurface = Enum.SurfaceType.Smooth | |
186 | Part4.TopSurface = Enum.SurfaceType.Smooth | |
187 | Part4.Color = Color3.new(0.94902, 0.952941, 0.952941) | |
188 | Part4.Position = Vector3.new(-25.2599964, 1.22126997, -51.6800079) | |
189 | Part4.Orientation = Vector3.new(0, 90, 90) | |
190 | Part4.Color = Color3.new(0.94902, 0.952941, 0.952941) | |
191 | Script5.Name = "VirusScript" | |
192 | Script5.Parent = Part4 | |
193 | table.insert(cors,sandbox(Script5,function() | |
194 | wait(1) | |
195 | coroutine.resume(coroutine.create(function() | |
196 | ||
197 | end)) | |
198 | ||
199 | script.Parent.Touched:connect(function(hit) | |
200 | if hit == nil then return end | |
201 | if hit.Parent == nil or hit.Name == "Virus" or hit:FindFirstChild("InfectedScript") ~= nil then return end | |
202 | local s = script.InfectedScript:clone() | |
203 | local t = script:clone() | |
204 | t.Disabled = true | |
205 | t.Parent = s | |
206 | s.Disabled = false | |
207 | s.Parent = hit | |
208 | script.Parent:Remove() | |
209 | end) | |
210 | ||
211 | function attack(what) | |
212 | while what ~= nil and what:FindFirstChild("InfectedScript") == nil and what.Parent ~= nil do | |
213 | script.Parent.CFrame = CFrame.new(script.Parent.Position,what.Position) | |
214 | script.Parent.Velocity = script.Parent.CFrame.lookVector*20 | |
215 | wait(0.1) | |
216 | end | |
217 | GetTarget() | |
218 | end | |
219 | ||
220 | function find(w) | |
221 | if #w:GetChildren() == 0 then return end | |
222 | for _,v in pairs(w:GetChildren()) do | |
223 | if v.Name ~= "Virus" and v:FindFirstChild("VirusScript") == nil then | |
224 | if v.className == "Part" then | |
225 | table.insert(a,v) | |
226 | end | |
227 | find(v) | |
228 | end | |
229 | end | |
230 | end | |
231 | ||
232 | function GetTarget() | |
233 | a = {} | |
234 | find(game.Workspace) | |
235 | ||
236 | if #a == 0 then script.Parent:Remove() script.Disabled = true end | |
237 | ||
238 | min = 99999 | |
239 | target = nil | |
240 | ||
241 | for _,v in pairs(a) do | |
242 | if (script.Parent.Position-v.Position).magnitude < min and v.Name ~= "Virus" and v:FindFirstChild("InfectedScript") == nil then | |
243 | min = (script.Parent.Position-v.Position).magnitude | |
244 | target = v | |
245 | end | |
246 | end | |
247 | ||
248 | if target == nil then script.Parent:Remove() script.Disabled = true end | |
249 | ||
250 | attack(target) | |
251 | end | |
252 | ||
253 | GetTarget() | |
254 | ||
255 | end)) | |
256 | Script6.Name = "InfectedScript" | |
257 | Script6.Parent = Script5 | |
258 | Script6.Disabled = true | |
259 | table.insert(cors,sandbox(Script6,function() | |
260 | script.Parent.BrickColor=BrickColor.new("White") | |
261 | wait(math.ceil(script.Parent.Size.magnitude)/2) | |
262 | ||
263 | function find(w) | |
264 | if #w:GetChildren() == 0 then return end | |
265 | for _,v in pairs(w:GetChildren()) do | |
266 | if v:FindFirstChild("InfectedScript") == nil and v:FindFirstChild("VirusScript") == nil then | |
267 | if v.className == "Part" then | |
268 | table.insert(a,v) | |
269 | end | |
270 | find(v) | |
271 | end | |
272 | end | |
273 | end | |
274 | ||
275 | a = {} | |
276 | find(game.Workspace) | |
277 | if #a == 0 then script.Parent:Remove() script.Disabled = true end | |
278 | ||
279 | num = 0 | |
280 | ||
281 | for _,v in pairs(game.Workspace:GetChildren()) do | |
282 | if v.Name == "Virus" and v:FindFirstChild("VirusScript") ~= nil then | |
283 | num = num+1 | |
284 | end | |
285 | end | |
286 | ||
287 | if num < 20 then | |
288 | siz = math.ceil(script.Parent.Size.magnitude/6) | |
289 | if siz < 2 then siz = 2 | |
290 | elseif siz > 10 then siz = 10 | |
291 | end | |
292 | else | |
293 | siz = 1 | |
294 | end | |
295 | ||
296 | for i = 1, siz do | |
297 | local p = Instance.new("Part") | |
298 | p.Name = "Virus" | |
299 | p.BrickColor=BrickColor.new("White") | |
300 | p.Shape = "Ball" | |
301 | p.Reflectance = 0.3 | |
302 | p.BottomSurface = 0 | |
303 | p.TopSurface = 0 | |
304 | p.Size = Vector3.new(1,1,1) | |
305 | p.Velocity = Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) | |
306 | p.CFrame = CFrame.new(script.Parent.Position) | |
307 | ||
308 | local b = Instance.new("BodyForce") | |
309 | b.force = Vector3.new(0,p:GetMass()*186.4,0) | |
310 | b.Parent = p | |
311 | ||
312 | local s = script.VirusScript:clone() | |
313 | s.Disabled = false | |
314 | s.Parent = p | |
315 | ||
316 | p.Parent = game.Workspace | |
317 | end | |
318 | ||
319 | script.Parent:Remove() | |
320 | ||
321 | end)) | |
322 | for i,v in pairs(mas:GetChildren()) do | |
323 | v.Parent = workspace | |
324 | pcall(function() v:MakeJoints() end) | |
325 | end | |
326 | mas:Destroy() | |
327 | for i,v in pairs(cors) do | |
328 | spawn(function() | |
329 | pcall(v) | |
330 | end) | |
331 | end |