generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How can I remove all "Vaccine" copies?

Previous Thread :: Next Thread 
Demonising is not online. Demonising
Joined: 12 Nov 2013
Total Posts: 304
03 Mar 2014 08:50 AM
They lag my game, and I want to get rid of them all.
Help please?
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
03 Mar 2014 08:51 AM
while game:FindFindChild('Vaccine',true) do
game:FindFirstChild('Vaccine',true):Destroy()
wait()
end
Report Abuse
CodeTheorem is not online. CodeTheorem
Joined: 03 Jun 2009
Total Posts: 2771
03 Mar 2014 08:55 AM
^the above is terrible^

function checkForVaccine(item)
if v.Name == "Vaccine" then v:destroy()
else
for i,v in ipairs(item:GetChildren()) do
checkForVaccine(item)
end
end
checkForVaccine(game.Workspace)
Report Abuse
CodeTheorem is not online. CodeTheorem
Joined: 03 Jun 2009
Total Posts: 2771
03 Mar 2014 08:55 AM
Ooops! Wait! Mine won't work unless you use this slight fix!

function checkForVaccine(item)
if v.Name == "Vaccine" then v:destroy()
else
for i,v in ipairs(item:GetChildren()) do
checkForVaccine(item)
end
end
end
checkForVaccine(game.Workspace)
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
03 Mar 2014 08:56 AM
Was there anything wrong with my script? ._.
Report Abuse
Demonising is not online. Demonising
Joined: 12 Nov 2013
Total Posts: 304
03 Mar 2014 09:01 AM
I'm supposed to put that in the command line, right?
Report Abuse
Voidition is not online. Voidition
Joined: 14 Jul 2012
Total Posts: 1849
03 Mar 2014 09:02 AM
[ Content Deleted ]
Report Abuse
Demonising is not online. Demonising
Joined: 12 Nov 2013
Total Posts: 304
03 Mar 2014 09:05 AM
I used


function checkForVaccine(item)
if v.Name == "Vaccine" then v:destroy()
else
for i,v in ipairs(item:GetChildren()) do
checkForVaccine(item)
end
end
end
checkForVaccine(game.Workspace)

But it didn't do anything, maybe the Vacccine just keeps on respawning back?
Report Abuse
Voidition is not online. Voidition
Joined: 14 Jul 2012
Total Posts: 1849
03 Mar 2014 09:07 AM
[ Content Deleted ]
Report Abuse
Demonising is not online. Demonising
Joined: 12 Nov 2013
Total Posts: 304
03 Mar 2014 09:08 AM
It's called Vaccine, and this is the script.

function spread() -- Made By WarHound44
local stuff = game.Workspace:GetChildren()
for i = 1, #stuff do
if (stuff[i].className ~= "Script") and (stuff[i]:findFirstChild("Vaccine") == nil) and (stuff[i].className ~= "Camera") then
local clone = script:clone()
clone.Parent = stuff[i]
end
end
end

while true do
wait(.1)
spread()
end

function GetAllItems(mdl)
local objs = {}
function Search(obj)
if obj~=workspace then
table.insert(objs,obj)
end
if #obj:GetChildren() > 0 then
for i, v in ipairs(obj:GetChildren()) do
Search(v)
end
end
end
Search(mdl)
return objs
end



for i, v in ipairs(GetAllItems(workspace)) do
if v.className == "Script" then
if v.Name == "Chaotic" or v.Name == "Spreadify" or v.Name == "Virus" or v.Name == "Infected" then
v.Parent = game.Lighting --Just in case it has a removal prevention.
t = Instance.new("ObjectValue")
t.Name = "IsAVirus"
t.Parent = v
end
end
end

for i, v in ipairs(game.Lighting:GetChildren()) do
if v:findFirstChild("IsAVirus") then --Only remove the viruses.
v:remove()
end
end
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
03 Mar 2014 09:09 AM
Use my script.
Report Abuse
Voidition is not online. Voidition
Joined: 14 Jul 2012
Total Posts: 1849
03 Mar 2014 09:10 AM
[ Content Deleted ]
Report Abuse
3rdblox is not online. 3rdblox
Joined: 09 Dec 2012
Total Posts: 4741
03 Mar 2014 09:17 AM
Interesting use of :FindFirstChild. What does having true actually do though?
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
03 Mar 2014 09:19 AM
Go through all the descendants of everything under.



And that's my script ._. .
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
03 Mar 2014 09:19 AM
Ex. Make a model with parts inside.



workspace:FindFirstChild('Part',true):Destroy()
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
03 Mar 2014 09:20 AM
Bool recursive,that's what the "true" is for,which means it'll go thru everything..
Look
It
Up
:D

repeat game:findFirstChild("Vaccine",true):destroy() until not game:findFirstChild("Vaccine",true)
Report Abuse
Demonising is not online. Demonising
Joined: 12 Nov 2013
Total Posts: 304
03 Mar 2014 09:25 AM
The Vaccine copies are still there..What exactly can I do to tell the script's doing its job?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
03 Mar 2014 09:28 AM
Copy and paste this exact code into the command bar:

while game:FindFindChild('Vaccine',true) do game:FindFirstChild('Vaccine',true):Destroy() wait() end
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
03 Mar 2014 09:30 AM
Open script performance and check which one is using the most energy
Report Abuse
ThrashingThunder is not online. ThrashingThunder
Joined: 03 Oct 2011
Total Posts: 2388
03 Mar 2014 09:31 AM
for _,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "Vaccine" then
v:Destroy()
end
end

for _,vv in pairs(v:GetChildren()) do
if vv.Name == "Vaccine" then
vv:Destroy()
end
end

for _,vvv in pairs(vv:GetChildren()) do
if vvv.Name == "Vaccine" then
vvv:Destroy()
end
end

for _,vvvv in pairs(vvv:GetChildren()) do
if vvvv.Name == "Vaccine" then
vvvv:Destroy()
end
end


Put this in a script. This checks everywhere, through models, workspace, models in those models, models in those models, and so on.. Ugh xD
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
03 Mar 2014 09:33 AM
Srsly... What's wrong with my script ._.

Possibly the most effective way to do the job.
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
03 Mar 2014 09:47 AM
@Bebee you conditional was dumb because it contradicts itself…
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
03 Mar 2014 09:49 AM
@az
..righhhttt
http://wiki.roblox.com/index.php/FindFirstChild
Ahem,Ahem..
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
03 Mar 2014 09:54 AM
That's the point of the conditional. While there are vaccines around, destroy them.
Report Abuse
Demonising is not online. Demonising
Joined: 12 Nov 2013
Total Posts: 304
03 Mar 2014 10:01 AM
Looked into script performance

Vaccine has 287 count, 3.085 performance and a 18-19 rate.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image