Attempt to yield across metamethod/C-call boundary error when firing RemoteFunction

Code where the error is happening, specifically the line where I invoke the server is where the error is happening

__newindex = function(_, Index, Value)
  Index = tostring(Index)

  print(_, Index, Value)
  if IsClient then
    print(_, Index, Value)
    if script:FindFirstChild("ClientToClientFiles"):FindFirstChild("InternalRemotes"):FindFirstChild("Make") then
      local Function = script.ClientToClientFiles.InternalRemotes.Make
      return Function:InvokeServer(Index, "E").OnClientEvent:Connect(Value)
    end
  end
end

(The above code is only a portion of my code)


It’s really weird because it does actually call the server and it works because I made the server print when it was invoked but i still get the errors on the line I invoke the server and its really confusing

I’m not sure if this is a bug or a issue with my code

You can’t call functions that yields inside metamethods because Luau doesn’t support suspending coroutines inside metamethod functions.

2 Likes