I’m sure I’m simply misunderstanding how type checking works but I have this function here:
local function collgroup(model: Model)
for i : number, v : BasePart in pairs(model:GetDescendants()) do
v.CollisionGroup = 'nocollision'
end
end
My issue is that this script still allows for instances other than BaseParts to pass through the for loop.
I’m aware that I could easily just do:
local function collgroup(model: Model)
for i : number, v : BasePart in pairs(model:GetDescendants()) do
if v:IsA('BasePart') then
v.CollisionGroup = 'nocollision'
end
end
end
but I want to at least understand how the type checking works.
Thanks!