How do i create a tween for visibility?

i’m tryng to make a message turn visible slowly every time the player makes a mistake but i can’t figure out how to tween the visibility property. please help

message.modulate = Color.TRANSPARENT
tween.tween_property(message, "modulate", Color.WHITE, TIME)

i’m unable to use the code you provided. look this is how i used it
the messegebox is a panel

		$MessegeBox.modulate = Color.TRANSPARENT
		create_tween().tween_property($MessegeBox, "modulate", Color.WHITE, 2)

Try this:

Turn invisible
create_tween().tween_property($MessageBox, "modulate:a", 0, 2)

Turn visible
create_tween().tween_property($MessageBox, "modulate:a", 1, 2)

1 Like

nope i get a error saying the tweenstarts with no tweeners

I created a test scene. The root node is Panel and this is the whole script:

extends Panel

func _ready() -> void:
	create_tween().tween_property(self, "modulate:a", 0, 2)

The original alpha value of modulate is 255 (set in inspector). When I run the scene the panel turns invisible in 2 seconds.