****What I am trying to do is, when I click on a button then all parts in the "PhoneOn" folder get transparent.
Button = script.Parent Button.ClickDetector.MouseClick:connect(function() local Screen = script.Parent.Parent.Screen for i,v in pairs {Screen} do if v.Material == Enum.Material.SmoothPlastic then v.Material = Enum.Material.Neon else v.Material = Enum.Material.SmoothPlastic end end --Mostly worrying about the script below. local PhoneOn = script.Parent.Parent.Parent.PhoneOn --PhoneOn is the name of the folder with parts in it. for i,v in pairs (PhoneOn:GetChildren()) do if v:IsA("Part") then v.Transparency = 1 end end end)
Why are you using the for ... in pairs loop? A generic for loop is much easier to follow.
local list = PhoneOn:GetChildren() for i=1, #list do if list[i].IsA("Part") then list[i].Transparency = 1 end end