Welcome to the forums @GreenPear!
I'd recommend using an exported string to handle this:
extends Area2D
export (string, FILE) var next_level_path = ""
func _physics_process(delta):
var bodies = get_overlapping_bodies()
for body in Bodies:
if body.name == "player":
get_tree().change_scene(next_level_path)
Then you can select the node in the Godot editor and set the scene through the inspector. This should also allow you to reuse the same script for all 30+ levels, you just will need to set the level for each one in the Godot editor :smile: