WHY ???

GenoxGenox Posts: 7Member
edited August 20 in Programming

I have only 2 scripts, one on a client, the other on the server. I just copied and pasted the code which was in the docs. It worked every time except now. I restarted another project, it still doesn't work. WHY ? I'm gonna cry.

This is the server :

This is the client :

And this is the server debugger, I don't understand where is this argument which ruins everything


Tags :

Best Answer

  • GenoxGenox Posts: 7
    edited August 20 Accepted Answer

    Thanks for answering (and sorry for swearing ^^')

    This was the full code and after some researches I found out the problem.

    The error was that the signal "network_peer_connected" sends an ID to the func "_player_connected".

    But I defined this func without argument so it cant recieve the ID. That is why it made an error.

    The solution was to change func _player_connected():
    To
    _player_connected(id):

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 1,709Admin

    Can you post the full code and/or the project and/or link to the documentation page? It's hard to say what could be causing the issue otherwise.

    Looking at the code that is visible and the post, one thing that could be potentially causing the issue is the 4000 port being used by another program. That could explain why the project was working, but is suddenly not working with no changes.
    Maybe try changing the port to another number and see if that works? If that doesn't work, maybe try restarting your computer, as that could free up the network port(s).

    Another thing that could be potentially causing the issue is connecting to the server before you connect the signals. Perhaps if the signals are not connected, Godot creates an error? I doubt this is the issue, but it might sometimes strange errors can arise.

  • GenoxGenox Posts: 7Member
    edited August 20 Accepted Answer

    Thanks for answering (and sorry for swearing ^^')

    This was the full code and after some researches I found out the problem.

    The error was that the signal "network_peer_connected" sends an ID to the func "_player_connected".

    But I defined this func without argument so it cant recieve the ID. That is why it made an error.

    The solution was to change func _player_connected():
    To
    _player_connected(id):

  • TwistedTwiglegTwistedTwigleg Posts: 1,709Admin

    Great! I'm glad you were able to solve the issue!
    (And no worries on the swearing, it's all good :smile: )

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file