Answered by
8 years ago Edited 8 years ago
You didn't call the function correctly. You indexed it, which is still calling it, but you need to reference the object again if you're doing it that way.
You have to think of object-based functions in roblox the same way you'd look at a table and it's contents.
example;
2 | Size = Vector 3. new( 1 , 1 , 1 ); |
3 | CFrame = CFrame.new( 0 , 0 , 0 ); |
4 | BrickColor = BrickColor.new( "Really red" ); |
5 | GetChildren = function (self) |
What you're doing is referencing the 'GetChildren' function by indexing it: workspace.Shirts.GetChildren()
Since you're doing it this way, the 'self' parameter shown in the example is never given. You have to provide it manually.
1 | parts = workspace.Shirts.GetChildren(workspace.Shirts) |
The most common way to call the function, is to "invoke it as a method" - as eLunate stated in the comments. To do this, you use a colon(:) to reference the function. This way, you don't need to manually provide the 'self' parameter.
1 | parts = workspace.Shirts:GetChildren() |