onready var player = get_node("/root/MainScene/Player")
func _process (delta):
position.x = player.position.x
Note: I fixed your code formatting.
Your problem is due to the order in which nodes become ready. "MainScene" is not ready when the Camera2D node becomes ready, so that path is not valid yet.
ok my camera should be ready last the way its lined up unless im misunderstanding how nodes load.
_ready() happens in reverse tree order. The camera is the first node to be ready. Then "Tile", then "Player", and finally "Mainsece". A parent is not ready until all of its children are.
Since Camera is ready first, its onready code runs. But since that code tries to access "Mainsece", it fails.