It's probably reacting to a different input event (such as InputEventMouseMotion and executing immediately after.
You should move the whole code block into the "if event i InputEventMouseButton:" block.
if event is InputEventMouseButton && event.is_pressed():
the rest of your code here
Also, you should store the textures in a variable and use preload instead of load... otherwise you're loading the texture each time you click.
var YellowVialTexture = preload ("res://......" )