Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why will it not scan workspace for anything in the virus chest variable?

Asked by 5 years ago

hi im wondering why this wont work, and if this is a bad slow way to do it, tell me. im making a anti virus plugin READ on bottom to see attempt to fix it by a previous question. main code that is probleming:

local w = workspace:GetDescendants()
    for i = 1, #VirusChest do
        if w[i].Name == #VirusChest then
            w[i].Parent = newFolder3

variables:

local VirusChest = {
    "join teh moovment!";
    "Kill tem!";
    "StockSound";
    "Deth 2 teh samurai!";
    "OHAI";
    "OH SNAP YOU GOT INFECTED XD XD XD";
    "No samurai plzzz";
    "4D Being";
    "Virus";
    "4dbeing";
    "4d being";
    "loser";
    "infected";
    "rolf";
    "Wildfire";
    "geometry";
    "guest talker";
    "anti-lag";
    "snap infection";
    "numbrez";
    "imahakwtfz";
    "wtfzor";
    "d??????????????ng.........you got owned...";
    "vivrus";
    "zomg saved";
    "hello...i ?m your new lord lolz";
    "worm";
    "guest_talking_script";
    "snapreducer";
    "snap-reducer";
    "script.....or..is.it";
    "timer";
    "datacontrollers";
    "chaotic";
    "teleportscript";
    "spreadify";
    "antivirussoftware";
    "ropack injection";
    "2_2_1_1_s_s_";
    "safity lock";
    "ropack";
    "ropack backup";
    "no availiblitly lock";
    "protection";
    "whfcjgysa";
    "073dea7p";
    "Snap Reducer";
    "ROFL";
    "Anti Lag";
    "AntiLag";
    "AntiVirus";
    "Anti-Virus";
    "Anti Virus";
    "Guest Free Chat Script";
    "lol";
    "bob";
    "Snap Remover";
    "SnapRemover";
    "N00B 4TT4CK";
    "!";
    "Vaccine";
    "garmo hacked ur place";
    "?9001";
    "bryant90";
    "Dont Worry Im A Friendly Virus";
    "IsAVirus";
    "Wormed";
    "vic";
    "stanley12345678910";
    "micolord";
    "charlie84";
    "cahrlie84";
    "SkapeTTAJA";
    "STFU NOOB";
    "Random?GoesHere:3";
    "Making Cat Ice Cream Make Me Happy!";
    "ANTIVIRISIS";
    "ANTIVIRIS";
    "77?";
    "IAmHereToHe?lYourPlace";
    "ProperGr?mmerNeededInPhilosiphalLocations;insertNoobHere";
    "I'm getting T1R33D";
    "H4XXX :3";
    "Sunstaff";
    "boomboom9188";
    "FreeStyleM?yGoAnywhereIfNeeded";
    "ThisScriptIsAJumpStartToAHe?lthyLifestyle";
    "d??????????????ng.........you got owned...";
    "Deidara4 is sick of you noobs.";
    "Fire";
    "FeelFreeToIns3rtGramm?tic?lErrorsHere";
    "Nomnomnom1 will hack you too! MWAHAHA!";
    "?";
    "ZXMLFCSAJORWQ#)CXFDRE)$#Q)JCOUSEW#)@!HOIFDS(AEQ#HI*DFHRI(#FA";
    "NoNoIDon'tNeedAllOfYourAwkw?rdSovietArguments";
    [[""''""''""?|`?]];
    "ISt?rtHere";
    "**virusmaster**";
    "Vivurursdd";
}

srry i had to rush it, pls help comment if u have questions

Also, trying to change to these as well, did not work:

for i, v in pairs(VirusChest) do

and

if w[i].Name == VirusChest[i] then

1 answer

Log in to vote
1
Answered by
compUcomp 417 Moderation Voter
5 years ago
Edited 5 years ago

Edit: So sorry! I wasn't thinking. Try this:

local w = workspace:GetDescendants()
for i = 1, #w do
    for j = 1, #VirusChest do
        if w[i].Name == VirusChest[j] then -- here was the problem (my problem and your problem)
            w[i].Parent = newFolder3

I wish there was a more efficient way to do it but sadly I cannot think of one.

Original: You are checking if anything in the workspace has a name that is equal to the number of things in your virus chest. You want to check if the name is equal to the current iteration.

local w = workspace:GetDescendants()
for i = 1, #VirusChest do
    if w[i].Name == VirusChest[i] then -- here was the problem
        w[i].Parent = newFolder3
0
Sorry to put u down, but if u read the whole thing I said i already tried something similar to this. I understand where the problem is. but replacing my code with that and making sure there's no silly errors, i get attempt to index nil with 'Name' RobloxGameingStudios 145 — 5y
0
its on line 3, sad isnt it of ur code RobloxGameingStudios 145 — 5y
0
I want to warn you that it is *very slow*. It is iterating (#VirusChest * #w) times. Stick a wait somewhere so studio doesn't crash compUcomp 417 — 5y
Ad

Answer this question