need help with tp command

Hi, i have a problem with my tp command, i added a custom item that tp the user when i use it, to listen the right click i use an advancement that execute this function. $execute as @s run execute in minecraft:$(Dimension) run tp @s $(X) $(Y) $(Z) I use a macro Dimension, where i store the dimension i'am in when i set up my checkpoint, everything work, BUT idk why when my item cooldown is finish without doing anything i got tp. This appen when i'am in a dimension ant tp into an other dimension.
Continue to help post