onmousedown on object teleport

im look to see how i would a kind of teleport system for my game. basically if my player walks up to a ladder and i click on the ladder it will teleport the player to a certain spot. i already know how to do this with triggers im curious if there is a way to do this with the OnMousDown or something along those lines

shoot a ray on mouseclick

check object hit. if it’s a ladder check the distance

if the distance is close enough, teleport the player.