Well, I'm trying to use "GetDescendants" but whenever I try to change the properties it won't work. Inside the object there are some other parts, 3 audios and 1 BoolValue. I wan't to change the material of those parts without having to write each one of them down.
I'll give an example of what I'm trying to do
local all = game.Workspace.Object:GetDescendants() all.Material = Enum.Material.ForceField
You need to set each object individually if you are using a table.
local all = game.Workspace.Object:GetChildren("Part") for i=1,#all do all[i].Material = Enum.Material.ForceField end
for i=1,#var do
will repeat that line for however many variables are in the table var
, #var
is a count of how many variables are in the table. i
increases by one each loop. all[i]
will go through each item on the table. And from what I know "Part"
is the name or type of instance you are getting.