Detect different enemies for different damage

Godot Version

4.1

Question

Is there a way using global scripts for a player to detect which “enemy” they are colliding with and then apply that amount of damage given from certain mob? For example if Player was hit by mob x they would take 5 damage, but if they were hit by mob y they would take 10 damage. How would I replicate that using global scripts?

What do you mean by “using global scripts”? If you want to get the damage a mob would inflict the player then give the mob script a class name. In that script @export a variable where you can set the damage it will apply in the inspector. And, finally, on the callback you get from the enemy colliding the player you do something like:

func _on_mob_collided(body):
	if body is Mob: # Mob is the class_name you gave to the mob script
		damage(body.attack_damage) # attack_damage is the @export variable