Client do nothing when try to conect

Godot Version

Godot Version: 4.2.1

Question

For some reason, client does nothing when try to connect.
The buttons signals are properly working

extends Node3D

@onready var address_entry : LineEdit = $Camera3D/CanvasLayer/PanelContainer/MarginContainer/VBoxContainer/AddressEntry

const PORT = 9999
var Address = "127.0.0.1"
var peer

func ready():
	multiplayer.peer_connected.connect(peer_connected)
	multiplayer.peer_disconnected.connect(peer_disconnected)
	multiplayer.connected_to_server.connect(connected_to_server)
	multiplayer.connection_failed.connect(connection_failed)

func _on_host_button_pressed():
	
	peer = ENetMultiplayerPeer.new()
	var error = peer.create_server(PORT,16)
	if error != OK:
		print("Coudn't Host: " + error)
	peer.get_host().compress(ENetConnection.COMPRESS_RANGE_CODER)
	
	multiplayer.multiplayer_peer = peer
	print(Address)

func _on_join_button_pressed():
	peer = ENetMultiplayerPeer.new()
	
	# DEBUG fazer o código de ip customizado
	peer.create_client(Address,PORT)
	peer.get_host().compress(ENetConnection.COMPRESS_RANGE_CODER)
	multiplayer.multiplayer_peer = peer

func peer_connected(id):
	print("Player Connected " + str(id))
func peer_disconnected(id):
	print("Player Disonnected " + str(id))
func connected_to_server():
	print("Connected to Server!")
func connection_failed():
	print("Couldn't connect.")

Do you run ready() from somewhere else? _ready() runs automatically but you missed an underscore.

holy molly, i’m so frustrated and relieved at the same time.
Thank you very much, code pal

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