(Multiplayer API) Error calling from signal 'peer_connected' to callable. Method expected 0 arguments, but called with 1

Godot Version

4.3

Background

I’ve been learning Godot multiplayer in order to make an MVP of a PvP shooter. I’m going for a dedicated server model.

I’ve managed to get the dedicated server up and running and have a client join it. These functions work.


The code comes from the same project using this code in the _ready() method of the main scene. This code works properly.

image

The Issue

Here’s the main issue.


When I test out the client/server connection, it works, but the signal that is emitted from the server when the client connects/disconnects returns an error.

According to the console, it’s because the method expected 0 arguments, but got 1. However, this makes no sense, because the multiplayerAPI signals needs 1 argument (another connecting function)

Here are the test function connected:
image

I know for a fact the prints will work, because this error also appears when it says only ‘pass’.

I’m not 100% sure how to fix this issue. Any help and/or insight would be appreciated.

its complaining about the function TestPeerConnected is not setup to take the argument peer_connected signal produces

func TestPeerConnected(): # < -- this needs a paramater
   print("Peer Connected")

it should be like this

func TestPeerConnected(id):
  print("Peer Connected ", id) 
1 Like

That was the solution. I’ll make sure to double check what arguments are needed next time. :+1:

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