Checking If There Is A Type Of Object In Children

Is there a way to check if a model has a type of object inside of it?

For example, if there’s an accessory in a player, is there a way to check if that accessory exists in the player or not and that it would return true because it exists? (or false if it doesn’t)

local Character = --Locate your model in workspace--
    for i, hat in pairs(Character:GetDescnedants())do
    	if hat:IsA("Accessory")then
    		--Your Code--
    	else
    		return false
    	end
    end
1 Like