Invalid Call. non exsistant function

Godot Version

4.5

Question

Hi i'm new to setting up multiplayer in godot. I was setting up a simple multiplayer following some yt tutorials and I run into this issue of "create_server" and "create_client" functions are nonexsistance. I've checked the latest documentation and this function was there. Can anyone point out what my issue is?

extends Node2D

var peer = ENetMultiplayerPeer.new
var PLAYER = preload("res://Scenes/player.tscn")

func _on_host_pressed() -> void:
	peer.create_server(65565, 2)
	multiplayer.multiplayer_peer = peer
	multiplayer.peer_connected.connect(
		func (pid):
			print("A player connected: "+str(pid))
			add_player()
	)
	add_player()



func _on_join_pressed() -> void:
	peer.create_client("localhost", 65565)
	multiplayer.multiplayer_peer = peer

Screenshot 2025-09-26 202110

The problem is actually where you initialize peer. You have:

var peer = ENetMultiplayerPeer.new

That should be:

var peer = ENetMultiplayerPeer.new()

The clue is in the error: Nonexistant function 'create_server' in base Callable

Callable is a function reference, and your code currently sets peer to be a reference to the new method of ENetMultiplayerPeer rather than calling that method and being assigned the return value. This then sits there as the wrong type of thing until on_host_pressed() steps on it.

1 Like