ReplicaOfClassCreated is not a valid member of ModuleScript "ReplicatedStorage.Lib.ReplicaController", even though it IS a valid member!

Hello, I tried to use ReplicaService but it seems like a function in the ReplicaController isn’t detected, even though it literally IS there!!!:

function ReplicaController.ReplicaOfClassCreated(replica_class, listener) --> [ScriptConnection] listener(replica)
	if type(replica_class) ~= "string" then
		error("[ReplicaController]: replica_class must be a string")
	end
	if type(listener) ~= "function" then
		error("[ReplicaController]: Only a function can be set as listener in ReplicaController.ReplicaOfClassCreated()")
	end
	-- Getting listener table for replica class:
	local signal = ClassListeners[replica_class]
	if signal == nil then
		signal = Madwork.NewScriptSignal()
		ClassListeners[replica_class] = signal
	end
	return signal:Connect(listener, function()
		-- Cleanup script signals that are no longer used:
		if signal:GetListenerCount() == 0 and ClassListeners[replica_class] == signal then
			ClassListeners[replica_class] = nil
		end
	end)
end

like please help me im going crazy

you need to require it

local ReplicaController = require(ReplicatedStorage.Lib.ReplicaController)

2 Likes

thank you so much omg this was so obvious i feel like a noob, humbling experience.

1 Like

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