W003 Error: I've tried the documented ways

Output:

W003: (76,24) Global 'CreatedSlots' is only used in the enclosing function 'Main'; consider changing it to local

Code:

	local FindOpenSlot = function(Tool)

		for _,VSlot in pairs(CreatedSlots) do
			if VSlot.Tool~=nil and VSlot.Tool == Tool then
				return
			end
		end

		for _,Slot in pairs(CreatedSlots) do 
			if Slot.Tool == nil then
				return Slot
			end
		end
		return CreateExtendedSlot()
		
	end

I’m pretty confused, anyone know how to solve this?

The code you posted has no flaws or errors.
The problem is with the variable “CreatedSlots”.
Show that code.

This is the part that shows an error:

local FindOpenSlot = function(Tool)

		for _,VSlot in pairs(CreatedSlots) do
			if VSlot.Tool~=nil and VSlot.Tool == Tool then
				return
			end
		end

		for _,Slot in pairs(CreatedSlots) do 
			if Slot.Tool == nil then
				return Slot
			end
		end
		return CreateExtendedSlot()
		
	end

	local FindSlotFromUI = function(Frame)
		for _,Slot in pairs(CreatedSlots) do
			if Slot.UI and Slot.UI == Frame then
				return Slot
			end
		end
		return nil
	end

Output:

W003: (76,24) Global 'CreatedSlots' is only used in the enclosing function 'Main'; consider changing it to local
W003: (87,10) Global 'CreateExtendedSlot' is only used in the enclosing function 'Main'; consider changing it to local

CreatedSlots does not have any variables.

for _,VSlot in pairs(CreatedSlots) do

The variable CreatedSlots must be created to function.
You are creating it globally, not locally.

your tables and functions seem to be in scope of another function, that is the reason behind the errors I believe