✓ Accepted answer
The problem is that you are always searching through the same set of children every time.
Because the Touched event doesn't give you the object you want to make transparent as an argument, it will probably be best to create a new function for the recursion. This is because we need to recursive function's parameters to have some meaning in terms of what should be going on in the function.
I've named the function setChildrenTransparency and it takes an object for the inital parent and a number for the value you want to set the transparency to. When we go through the function the first time it will loop through the children in object setting each child's transparency to the given value if it inherits from BasePart. For each child, we also want to run the function again except this we want to examine the children of child. So now we pass child in as the parent object and it runs again.
This process keeps going until every single descendant of the original parent has been checked.
local function setChildrenTransparency(object, value)
for _, child in ipairs(object:GetChildren()) do
if child:IsA("BasePart") then
child.Transparency = value
end
setChildrenTransparency(child, value)
end
end
To put this function to work in your Touched event, we can use it like this:
local model
script.Parent.Touched:connect(function(hit)
setChildrenTransparency(model, 1)
end)