model = game.Workspace.Model:GetChildren()
for i, v in pairs(model) do
v.Transparency = 0.5
i = model [1]
i.Transparency = 0.8
end
It kinda works, but it isn't the first one as stated in the brackets.
model = game.Workspace.Model:GetChildren()
for i, v in pairs(model) do
v.Transparency = 0.5
i = model [1]
i.Transparency = 0.8
end
It kinda works, but it isn't the first one as stated in the brackets.
This changes all the parts transparency inside the model to 0.8 :
local Model = workspace.Model
for i, Part in ipairs(Model:GetChildren()) do
Part.Transparency = 0.8
end
This changes the first part's transparency in the model to 0.5 :
local Model = workspace.Model:GetChildren()
local Part = Model[1]
Part.Transparency = 0.5
This changes the first part's transparency in the model to 0.5 and 0.8 to everything else :
local Model = workspace.Model:GetChildren()
for i, Part in ipairs(Model) do
if Part == Model[1] then
Part.Transparency = 0.5
else
Part.Transparency = 0.8
end
end
This changes all the parts transparency inside the model to 0.8 then changes the first part's transparency to 0.5 :
local Model = workspace.Model:GetChildren()
for i, Part in ipairs(Model) do
Part.Transparency = 0.8
end
local Part = Model[1]
Part.Transparency = 0.5
You can change this :
local Part = Model[1]
Part.Transparency = 0.5
To this :
Model[1].Transparency = 0.5
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Use ipairs(). GetChildren() returns an array and ipairs() is made specifically for arrays.
oh... i didn't know that, thanks i'll edit it