google sheets – Automatic date cell when the opposite cell is filled – problem with the script

This question has been asked here and I am publishing a new publication because I could not figure out how to respond to that.
I installed the script and saved it, but no date appears on my sheet when I insert new data. I have never used scripts before. When I run the script in the script editor, an error appears on line 7 where it says: "var eventRange = event.range;", which says: "TypeError: Unable to read property" range "of undefined".
What am I doing wrong?
Thank you!