How to change scene when player touching/entering an area?

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

I want that when the player/camera touches/enter an area to change to another scene.

:bust_in_silhouette: Reply From: Gluon

You would need something to trigger the change, so either have an area2d or a collision box so you know when the player has stepped there. You can then put some code in so maybe set up a signal with a on_body_entered signal for example. connect that to a function once there you can change scenes with code like this

get_tree().change_scene("res://Menu/MenuScreen.tscn")