I’m sorry for not being clear, but the table contains each ancestor of the virus. So when the string gets parented to a new parent, it’ll add it to the table. I won’t know how many arrays it will create because there can be a big number of parents. I’m wondering how I’d get each array and put them in order and add dots so it’ll look like
game.Workspace.BlahBlah.Injector
Ohhhh I think I get it. So the StringValue will just serve as a temporary iterator?
In other words, the final table should look something like this? And you’d want to work on concatenating the strings as well, I would assume.
{
{
[1] = "Part",
[2] = "Folder",
[3] = "Workspace",
[4] = "game",
},
{
[1] = "Folder",
[2] = "Workspace",
[3] = "game",
},
{
[1] = "Workspace",
[2] = "game",
},
{
[1] = "game",
}
}
Yes! You’ve got it! Charsssssss
So you want a script that takes one of those above arrays, and creates an array that contains all of the ancestor addresses? Like this?
local ancestorTable =
{
{
[1] = "Part",
[2] = "Folder",
[3] = "Workspace",
[4] = "game",
},
{
[1] = "Folder",
[2] = "Workspace",
[3] = "game",
},
{
[1] = "Workspace",
[2] = "game",
},
{
[1] = "game",
}
}
local addressStrings = {}
for i, address in pairs (ancestorTable) do
local s = ""
for j = #address, 1, -1 do
s = s .. address[j]
s = s .. "."
end
s = string.sub(s, 1, string.len(s)-1)
table.insert(addressStrings, s)
end
print(addressStrings)
I still feel like I’m not 100% understanding still.
Thanks! I’m going to mark it as a solution as soon as I test it. One last question, can you do IsA in plugins? It says i don’t have permission and it’s my if statement checking if the virus is a script for no false-positives.
I still don’t understand tables. I don’t know why. Especially for loops with numbers.
Unsure of the context in which you’re using it, but I have heard of some issues regarding IsA() in similar cases to yours.
Is this the same error you’re getting? Maybe this post will help.
Yeah… they can be quite challenging! It’s just something that you’ll have to practice over and over until you master it. You got it though!
Close to my error, but i have permission 5, not 2.
Oh. Roblox doesn’t let you use IsA. I’ll have to find a bypass to read the script code.
What’s the issue? Are you asking why the ID’s are printed out like that?
Well i didn’t want the ids printed. I wanted the contents. I really suck at tables huh.
Go to the output log, click the 3 dots and turn off log mode.
uhh still not good.
Small bump but you can do something like:
for _, directory in pairs(addressStrings) do
print(directory)
end
Just prints each thing inside the “addressStrings” table
Obj:IsAncestorOf(AncestorPart)
That doesn’t answer the OP’s question; it just returns a boolean on whether or not an Instance is an Ancestor of another Instance. The OP is asking how to fetch all of the Ancestors of an Instance
You can use Obj:GetFullName() which returns the EXACT path of something. Then based on that, you can run a for loop to find if it is a descendant of something.
–When current == game, stop the code
I believe your function is meant to look like this
function getPath(instance)
local path = instance.Name
local current = instance.Parent
while current do
path = current.Name … “.” … path
current = current.Parent
end
return path
end
Correction: ipairs. I’ll try this whenever i can.
Hmm. I’m gonna look more into it. Never knew this method existed.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.