The method "hide" isn't declared in the current class.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dc37

I followed some tutorial on Youtube and it seems everything worked for him, but in my end I keep getting this error:

The method “hide” isn’t declared in the current class.

Here is my code:

extends Node

var address = ""
var port = 3377

# Called when the node enters the scene tree for the first time.
func _ready():
get_tree().connect("network_peer_connected", self, "_player_connected")

func _on_ButtonHost_pressed():
    var net =
    net.create_server(port, 2)

func _on_ButtonJoin_pressed():
    var net =
    net.create_client(address, port)

func _player_connected(id):
    Globals.player2id = id
    var game = preload("res://Scenes/Game.tscn").instance()

I have to put a hide() there after all players are connected so it would hide the Lobby scene (of which this script is attached to), then load the Game.tscn. Any way to fix this error? I already tried closing and re-opening Godot and it still gave me this error.

:bust_in_silhouette: Reply From: kidscancode

Your script extends Node. hide() is not a method of Node, it’s a method of CanvasItem.