So I have this scirpt that should transparent all the children in the model, but it only transparent’s 1? Any help?
local Player = game.Players.LocalPlayer
game.Workspace.BackpackGuiPart.SurfaceGui.Watches.PurpleWatch.MouseButton1Click:connect(function()
local dog = game.Workspace.PurpleWatch:GetChildren()
dog.Transparency = 0
local r = game.Workspace.RedWatch:GetChildren()
r.Transparency = 1
local b = game.Workspace.BlueWatch:GetChildren()
b.Transparency = 1
local bl = game.Workspace.BlackWatch:GetChildren()
bl.Transparency = 1
local w = game.Workspace.WhiteWatch:GetChildren()
w.Transparency = 1
end)
print("success")
:GetChildren returns a table
have to go through each item and set transparency
essentially just for loop through the children checking to see if its a part
local w = game.Workspace.WhiteWatch:GetChildren()
for i in pairs(w) do
if w[i]:isA("BasePart") and w[i].Name ~= "Watch" then
w[i].Transparency = 1
end
end
Yes, I have seen this usage before. I am still getting used to Lua.
I am assuming it is syntax alternate and doesn’t affect performance, would that assumption be correct?