Hello developers,I am trying to make a server-client communication module and I encountered this weird error. Returned value’s metatable is nil.
There’s 0 issue with the remote creations.
Module Code (Client Side):
local Signal do
Signal = {}
Signal.__index = Signal
function Signal:Fire(...)
self.__signal:FireServer(...)
end
function Signal:Connect(handler)
assert(typeof(handler) == "function", OutputFormat:format("Argument #1 must be a function"))
self.__signal.OnClientEvent:Connect(handler)
end
end
function KoolClient:GetService(name: string)
assert(typeof(name) == "string", OutputFormat:format("Argument #1 must be a string"))
local res = ServiceRetriever:InvokeServer(name)
if serverStarted.Value then
local endpointsfolder = script.Parent:FindFirstChild("EndpointsFolder", true).Value
if res then
local folder = endpointsfolder:WaitForChild(name)
local service = {}
for i, v in pairs(folder:GetChildren()) do
if v:IsA("RemoteFunction") then
service[v.Name] = function(...)
return v:InvokeServer(...)
end
RunService.Heartbeat:Wait()
end
if v:IsA("RemoteEvent") then
service[v.Name] = setmetatable({__signal = v}, Signal)
RunService.Heartbeat:Wait()
end
for i, v in pairs(res) do
service[i] = v
RunService.Heartbeat:Wait()
end
RunService.Heartbeat:Wait()
return service
end
else
warn(OutputFormat:format(name.." does not exist"))
end
else
warn(OutputFormat:format("All Services aren't available until Kool has started"))
end
end
Client Code:
print((getmetatable(Kool:GetService("DataService").E)) --prints nil
Sorry for my bad English. Any help is appreciated