Incorrect projectile spawn relative to cursor pos

Godot Version

v4.2.2.stable.official [15073afe3]

I have been following an 11 hour tutorial about godot and I’ve arrived at a roadblock. Its a topdown game where you do some shooting. Now the main issue is the following:
I spawn a grenade RigidBody2D when I “shoot”, but after trying to implement the direction of the cursor to update the direction of the grenade, the actual direction of the spawned grenade is broken. What I mean by that is that the greande never wants to go into positive Y coordinates, but rather always down and almost never into the direction of the cursor. The direction however does change, but not in a consistent way that is logical. I will now provide you with the code:
This code is in the
if Input.is_action_just_pressed(“shoot grenade”) and can_grenade:
can_grenade = false #for timer to start
$grenT.start() #timer
var pos = $LaserStartPos.get_children()[0].global_position
var player_direction = get_global_mouse_position() - pos.normalized()
grenadeshot.emit(pos, player_direction)
This is the code that is in the main node:
func _on_player_grenadeshot(pos, player_direction):
var grenade = grenade_scene.instantiate() as RigidBody2D
grenade.position = pos
grenade.linear_velocity = player_direction

Both of them are in the _proces func and also the velocity of said grenade changes based on the players direction which makes no sense to me. Is there even a way to fix this?

Make sure to use the code block button </> on a new line when pasting code

type or paste code here

var player_direction = (get_global_mouse_position() - pos).normalized()

This needed parenthesis around the subtraction for a correct order of operations, but you could use godot’s direction_to for the same equation as a function.

var player_direction = pos.direction_to(get_global_mouse_position())