bro! Could you lend me your source code in the most current version of Godot?:0
Hey mate, the script I made won't work in Godot 4 out of the box as I wrote it a long time ago for Godot 3.X ; however happy for you to grab the project files and try and adapt it for Godot 4.
https://drive.google.com/file/d/1oJIbub7TJuwfhbPtYZtRYQQ54fSf-aS5/view?usp=sharing