Disconnecting Players Weird Error

Godot Version

Godot 4.4.1

Question

I’m trying to disconnect the players when they click the “quit” button. This is the code I have for the button:

func OnQuitPressed():
	if multiplayer.is_server():
		multiplayer.multiplayer_peer.close()
	else:
		multiplayer.multiplayer_peer.disconnect_peer(multiplayer.get_unique_id())
	LevelManager.ReturnToMainMenu()

However, I get the following error when the button is clicked:
Condition "!_is_active() || !peers.has(p_peer)" is true.

I tried looking around a little, but I couldn’t find anything about this error. This feels obvious, but I am quite new to the engine (this multiplayer shooter is my first project). If you need more information, just let me know. Thank you!

use disconnect_peer(1) to disconnect from the server (it always has id 1)

1 Like

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