Let's use tables and loops!
So, let's assume everything inside workspace.Invis are the parts we want, with no extra script, ect. We can use GetChildren() to get everything inside of the part, model, folder, ect, and use a integrated for loop to go through everything, changing what we want.
First, lets get everything in workspace.Invis with GetChildren,
local parts = workspace.Invis:GetChildren()
Now we have to loop through to get all the parts,
local parts = workspace.Invis:GetChildren()
for i,v in pairs(parts) do
print(v.Name)
end
This will print the names of all the parts/objects in the table, "parts".
Now we have to simple change the Transparency property of the parts.
local parts = workspace.Invis:GetChildren()
for i,v in pairs(parts) do
v.Transparency = 1
end
If however not everything in workspace.Invis are parts, we can check for this with the IsA() function. This is only necessary if you have things in workspace.Invis that are not parts.
local parts = workspace.Invis:GetChildren()
for i,v in pairs(parts) do
if v:IsA("Part") than
v.Transparency = 1
end
end
You would use an and operator and check for a Union if you are using them.
Adding this information to the functions,
Simple enough. Just place this code in the functions. Example,
local parts = workspace.Invis:GetChildren()
local function onEquip()
for i,v in pairs(parts) do
v.Transparency = 0
end
end
local function onUnequip()
for i,v in pairs(parts) do
v.Transparency = 1
end
end
Let me know if you have any issues.
Good Luck!
1 comment
You would be the one to answer my question