How can I make this script check the workspace for any part named 'window' every 300 seconds and change the transparency to 0 and the cancollide to false?
I've tried this already.
while true do wait(300) a = game.Workspace:getChildren(game.Workspace) if a.Name == "Window" then a.Transparency = 0 a.Cancollide = false end
The GetChildren()
function returns all the children of the instance it is called on packaged in a table. If you want to search for any part named "Window", then you would iterate or go over the table returned by the GetChildren
function. Iterating is usually done with a generic for loop which is implemented below. On every iteration the script checks if the current child is a window and if so, changes the Transparency
and CanCollide
properties.
while true do wait(300) children = game.Workspace:GetChildren() for _ , a in pairs (children) do if a.Name == "Window" then a.Transparency = 0 a.CanCollide = false end end end
try use findFirstChild, i think this is the ebst way to do it