How to change scene after video has ended?

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

Ive tried
func _on_VideoPlayer_finished():

and still, nothing happens. can someone help me???

:bust_in_silhouette: Reply From: samjmiller

It’s tough to tell from the code you posted (it’s always good practice to format your code using the “Code Sample” brackets, to make sure it is fully legible), but it looks like you have gettree() instead of get_tree(), which could be the problem.

If that’s not the problem, double check that the path to the scene you want to start is correct. Looks like res://path/to/World.tscn could be code copied from an online tutorial, which won’t work for you unless your “World.tscn” scene is inside a folder called “to” which is inside a folder called “path”. If “World.tscn” is in the root folder of your project, with no subfolder, the path would be "res://World.tscn."

But you can easily find out exactly what the path is for your World.tscn scene by going to the FileSystem dock (which defaults to lower left of the Godot interface), right clicking that particular scene, clicking on “Copy Path,” and then pasting that path into the quotation marks - which should look something like this:


You can also use print() to debug the code, find out where the issue is - adding this line to the function right below get_tree

print ("You should have changed scenes by now!")

… and then checking the console to see whether that text comes up. If it doesn’t show up in the console, it means there’s a problem with the function itself - maybe a signal isn’t properly connected.

omg, thanks soo much it worked!

FranTheMan | 2021-08-30 22:11

That’s great! If you wanted to click the check mark to “select this as best answer,” that’d be awesome.

samjmiller | 2021-08-30 22:37