How do I get the children of GetChildren()?
Asked by
5 years ago Edited 5 years ago
Alright so, I would like set to the scripts inside a model (which is parented to workspace) to Disabled = false when an event is fired, however I am stuck on how I would access these scripts using a for loop.
I currently have the script below but it doesn't seem to work.
Any help would greatly be appreciated!
03 | event 3. OnInvoke = function () |
04 | local AIScripts = game.workspace:GetDescendants() |
05 | for i = 1 , #AIScripts do |
06 | if AIScripts [ i ] :IsA( "Model" ) then |
07 | if AIScripts [ i ] .Name = = "AI" then |
08 | if AIScripts [ i ] :IsA( "Script" ) then |
09 | AIScripts [ i ] .Disabled = false |