Tween not executing

I’m trying to tween the visible_ratio on a Label for a game-over screen so that it smoothly types out. For some reason, the tween isn’t playing. The main GUI appears, but the text on the label that’s supposed to say “GAME OVER” doesn’t appear at all.

func gameover():
	can_open_pause_menu = false
	get_tree().paused = true
	
	var gameovergui: Control = get_tree().current_scene.get_node("CanvasLayer/GAME OVER SCREEN")
	var label: Label = gameovergui.get_node("CenterContainer/PanelContainer/GAME OVER")
	var button: Button = gameovergui.get_node("CenterContainer/PanelContainer/START ALL OVER")
	
	var sound: AudioStreamPlayer = gameovergui.get_node("GameOver")
	
	sound.play()
	
	gameovergui.visible = true
	
	label.visible_ratio = 0
	var tween = create_tween()
	tween.tween_property(label, "visible_ratio", 1.0, 1)
	tween.set_trans(Tween.TRANS_EXPO)
	tween.set_ease(Tween.EASE_OUT)
	await tween.finished
	
	button.visible = true
	await button.button_up
	
	get_tree().paused = false
	get_tree().reload_current_scene()
	can_open_pause_menu = true 

This is a function in an “Autoload Singleton” something whatever it is, where other scripts can execute the gameover() function.

Everything’s Process modes are set to “Always”.

You’ve paused your scene tree.

1 Like

They run while paused.

You should add

tween.set_pause_mode(Tween.TweenPauseMode.TWEEN_PAUSE_PROCESS)

you’re looking for

tween.set_pause_mode(Tween.TWEEN_PAUSE_PROCESS)

the tween doesn’t inherit the pause process of the node it was made in: you have to manually set it.

1 Like