lune/tests/roblox/instance/methods/FindFirstChildWhichIsA.luau
2023-05-20 19:49:37 +02:00

18 lines
572 B
Text

local roblox = require("@lune/roblox")
local Instance = roblox.Instance
local root = Instance.new("Folder")
local child = Instance.new("Model")
local nested = Instance.new("Tool")
local adjacent = Instance.new("Model")
local descendant = Instance.new("Part")
descendant.Parent = nested
nested.Parent = child
adjacent.Parent = child
child.Parent = root
assert(child:FindFirstChildWhichIsA("Folder") == nil)
assert(child:FindFirstChildWhichIsA("Tool") == nested)
assert(child:FindFirstChildWhichIsA("Model") == nested)
assert(child:FindFirstChildWhichIsA("Part") == nil)