Cannot find child in object

I am still trying to figure out how to find unknown child in a object. Problem with this thing is it won’t even run. Here is the script. I have been trying to figure this problem out for hours now and I cannot seem to fix it.

local toolFound 
local chosen_spawner


for _,spawners in pairs(game.Workspace.Spawners:GetChildren()) do
	if string.find(spawners.Name,"toolSpawner") then
		toolSpawners = spawners
		for i,v in pairs(toolSpawners:GetChildren()) do
			if v:IsA("Tool") then
				tool = v
				chosen_spawner = v.Parent
				print("Yes")
				toolFound = true
				print(chosen_spawner)
			end
		end
	elseif not tool then
		print("No tool")
	end
end
  1. Any errors?
  2. Is anything printing?
  3. Is this script somewhere that it can run like ServerScriptService, workspace, etc?
  4. Is it a local script or server script?

It is a module script. I think the error is the “string.find” line. I tested it last night and that is what it seems like that is the thing that is stopping everything

for _,spawners in pairs(game.Workspace.Spawners:GetChildren()) do
	if spawners.Name == "toolSpawner" then
		toolSpawners = spawners
		for i,v in pairs(toolSpawners:GetChildren()) do
			if v:IsA("Tool") then
				tool = v
				chosen_spawner = v.Parent
				print("Yes")
				toolFound = true
				print(chosen_spawner)
			end
		end
	elseif not tool then
		print("No tool")
	end
end

Module scripts don’t run without external execution from a local script or script. Since the code is written out in the module script, simply requiring it will run it which means it’ll run everytime a script requires it. Keep that in mind. You can run your module script code by using:

local moduleScript -- set to the path of the module script
require (moduleScript) -- this will execute the script

NOTE: How the script executes (locally or in the server) depends on whether you use a localScript or a serverScript, respectively.

The issue could also be because you didn’t say what after “then” , like an else statement, for example

		if spawners.Name == "toolSpawner" then
			toolSpawners = spawners
			for i,v in pairs(toolSpawners:GetChildren()) do
				if v:IsA("Tool") then
					tool = v
					chosen_spawner = v.Parent
					print("Yes")
					toolFound = true
					print(chosen_spawner)
					else
					print("no tool")
				end
			end
		end
	end