extends Sprite

onready var speed = 50
var moving = true
var destination = get_node("/root/Mainmenu/destination1").global_position

func go_destination1(delta):
	if moving:
		$object.global_position = $object.global_position.move_toward(destination * speed)

im not really sure how to make an object move in a direction and i cant find much stuff on it and the closest i got it wasn't correct.

If that's the entire script, nothing is going to happen, since the function "go_destination1" is never called. If you rename the function to "_physics_process", it will get called 60 times per second.

Is "object" a child node of the node to which that script is attached?

Are there any error messages?

The object is a parent node and there is an error it says Invalid get index 'global_position' (on base: 'null instance')

sorry beginner dont really know much

    janieldoohick123 Try changing the first line from extends Sprite to extends Sprite2D
    As far as I know there is no Sprite Node, unless you made another class with class_name Sprite extends Sprite2D.

    On which line did it throw the error?

    it gives me an error when i change the name to sprite2d and the line with the error is

    var destination = get_node("/root/Mainmenu/destination1").global_position

    The destination node you are trying to get, for some reason, doesn't exist at the time you are setting the destination variable.
    Maybe a screenshot of the scenetree can help.

    It is probably some ordering problem in the tree, where the node you are trying to access is above the node you are trying to access it from.

    Or a typo inside the get_node function.

    According to the docs of Node:

    Node get_node ( NodePath path ) const

    Fetches a node. The NodePath can be either a relative path (from the current node) or an absolute path (in the scene tree) to a node. If the path does not exist, null is returned and an error is logged. Attempts to access methods on the return value will result in an "Attempt to call <method> on a null instance." error.

    Note: Fetching absolute paths only works when the node is inside the scene tree (see is_inside_tree).

    And NodePath docs:

    Some examples of NodePaths include the following:

    # No leading slash means it is relative to the current node.
    ^"A" # Immediate child A
    ^"A/B" # A's child B
    ^"." # The current node.
    ^".." # The parent node.
    ^"../C" # A sibling node C.
    # A leading slash means it is absolute from the SceneTree.
    ^"/root" # Equivalent to get_tree().get_root().
    ^"/root/Main" # If your main scene's root node were named "Main".
    ^"/root/MyAutoload" # If you have an autoloaded node or scene.

    I'm gonna wild guess that the error is thrown when you run the main scene but not when you run this specific scene.
    I believe the node path should be "/root/Node2D/Mainmenu/destination1", but this will only work if the Mainmenu scene is a child of Node2D AND your Node2D is actually the main scene.
    The catch is, the Mainmenu scene will not work alone, and if it has a different parent it won't behave properly.

    I advice you use relative paths, something like "../destination1" as the transition and destination1 are siblings, and will work no matter what the parent of Mainmenu is.
    Just beware of changing where the destination node is.

    And I think it is the Mainmenu's responsibilty to move its transition sprite child to the destination, or at least tell the transition to move to the destination via a function.

    Edit: Note: the previous quotes are from Godot 4.0.3 docs, but I believe the same applies to the Godot 3.x version you are using, if I inferred correctly from the screenshot and the Sprite class.