|
|
(5 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| {|
| | #REDIRECT [[IsA_(Method)]] |
| |<onlyinclude>
| |
| {{Function|
| |
| name = IsA
| |
| |arguments = [[String]] classname
| |
| |returns = [[Boolean]]
| |
| |description = Returns true if instance is that class or a subclass
| |
| |object = Global
| |
| |}}</onlyinclude>
| |
| |}
| |
| | |
| | |
| IsA is useful for figuring out if an object is a specific type of object. For example, if you do <code>Part:IsA("Part")</code> it will return "true". Also, you can use structural classes, or classes that cannot be created through <code>Instance.new(string classname)</code>. For example, you can do <code>Part:IsA("BasePart")</code>.
| |
| | |
| {{Example|This can be used to find an object related to a part in a list of objects.
| |
| | |
| <pre>
| |
| children = script.Parent:GetChildren()
| |
| | |
| for i=1, #children do
| |
| if children[i]:IsA("BasePart") then
| |
| print(children[i].Name .. " is a Part object.")
| |
| end
| |
| end
| |
| </pre>
| |
| }}
| |