How to play a sound once KinematicBody2D collides with CollisionShape2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By HarryCourt
:warning: Old Version Published before Godot 3 was released.

I’m trying to get a sample to play once collided with a player, any way on how to do this? If so, what’s the line I have to put in?

:bust_in_silhouette: Reply From: kidscancode

If you’re using SamplePlayer, you just use play() with the name of your sample:

get_node("SamplePlayer").play("hit")