Your comments

quote
but I'm pretty sure that you will already find dozens of examples for such a script
unquote

I've looked, none of them work, or require a rigidbody which
isn't part of my player character. I've found elevator scripts which are part of other projects, have to extract them I guess.

https://sites.google.com/site/terrymorgan1213/tutorials