I want to make all children of the map Transparency = 0 when someone touches a brick
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then script.Parent.Parent:GetChildren().Transparency = 0 end end)
The LocalScript is in a Part which is in the Folder.
you can use a for loop
which literates through a table, so you can use :GetChildren()
as it returns a array or well a table and use the variable.
local descendants = script.Parent.Parent:GetChildren() -- define where all the children are for _,v in pairs(buttons) do -- "v" can be named anything print(v.Name) -- prints each item's name; just an example -- stuff end
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then for i,v in pairs(script.Parent.Parent:GetChildren()) do v.Transparency = 0 end end end)