The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

My script:

extends Node2D

const DEFAULTPORT = 28960
const MAX
CLIENTS = 6

var server = null
var client = null

var ip_address = ""

func ready() -> void:
if OS.get
name() == "Windows":
ipaddress = IP.getlocaladdresses()[3]
elif OS.get
name() == "Android":
ipaddress = IP.getlocaladdresses()[0]
else:
ip
address = IP.getlocaladdresses()[3]

for ip in IP.get_local_addresses():
    if ip.begins_with("192.168."):
        ip_address = ip

get_tree().connect("connected_to_server", self "_connected_to_server")
get_tree().connect("server_disconnected", self "_server_disconnected")

func createserver() -> void:
server = NetworkedMultiplayerENet.new()
server.create
server(DEFAULTPORT, MAXCLIENTS)

func connectedto_server() -> void:
print("Seccessfully connected to the server")

func serverdisconnected() -> void:
print("Disconnected from server")

please help ty in advance

Godot version 4 i think
in Engine by (12 points)

It's hard to say since your code isn't properly formatted above but I'd guess you might have an indention problem in that area of your code. If you can't find it, edit the above post and format the code (via the {} button in the forum editor's toolbar).

Godot 4 doesn't exist, you probably meant to say Godot 3.4.?

Take a look at your Godot application, and on the bottom right of the output it'll tell you the version you're running.Godot Version

To be fair, I'm currently using Godot 4.0 alpha4, but admittedly the "i think" at the end really does add a lot of uncertainty to the version number

Im trying to do the same thing!
I also have this error and i have no idea what should i do
I'm using godot stable release 3.5

"unexpected token" means Godot didn't expect to see that written where you've written it.

In future, if you want help, you should post your actual code, because just saying "I have this error" means we can only guess at what you've done wrong. Make sure you format your code correctly - there's a button for that when you're posting here (it looks like {}).

Also, make your own post - don't reply to a 6 month old post that the original poster never replied to.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.