I have a tab container that has three tabs, one for each of my characters, my intention is to have a label for each tab that displays how much Gold/Coins they have, so i thought the best idea was to have all three labels invisible and then make them visible when their tab was the current_tab however nothing is showing up and im not sure what im doing wrong, here is an image of my code

Hi, try using show() and hide() functions instead of set_visible(true)

@Danicron said: I have a tab container that has three tabs, one for each of my characters, my intention is to have a label for each tab that displays how much Gold/Coins they have, so i thought the best idea was to have all three labels invisible and then make them visible when their tab was the current_tab however nothing is showing up and im not sure what im doing wrong, here is an image of my code

If you are using Godot 3, you can directly edit the visible property instead of using set_visible, or you can use the show and hide functions as @Saran suggested.

Regardless, one of the major reasons your code is not working is because _on_characters_tab_changed is empty. _on_characters_tab_changed is connected to a signal, right? Then you need to place the code you want to run when the signal is called (in this case, when the tab is changed) in _on_characters_tab_changed.

For example, if you replace the code with the following then it should work (though the code below is untested!):

func _ready(): load("res://Coins.gd") func _on_Characters_tab_changed(tab): if (tab == 3): get_node("/root/Coins").set_thiefcoins() visible = true set_visible_characters(-1)

4 years later