How do I get past this warning in type checking? Or do I just leave it be?

Hi,

I am getting a warning after trying this:

function Interaction.Triggered(self: ClassType): ()
	if not self.CurrentObject:FindFirstChild("Interaction") then
		warn("Couldn't find interaction module inside of:", self.CurrentObject.Name)
		return
	end
	
	local Module = require(self.CurrentObject:FindFirstChild("Interaction"))
	
	if type(Module.Interact) == "function" then
		task.spawn(function()
			Module:Interact()
		end)
	end
end

This module that I am trying handles interaction from another module that is placed inside any object that is interact-able.

I get the warning: Unknown Require: Unsupported Path

it seems like the following line is the one that is causing errors:

local Module = require(self.CurrentObject:FindFirstChild("Interaction"))

If you print out the value of self.CurrentObject:FindFirstChild(“Interaction”), what is the object type?

1 Like

If this module will eventually exist at some point, use WaitForChild. You are probably calling the function too early during initialization.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.