Is there a way to make my addon not teleport through walls?

I’m trying to make an addon that will teleport to the player and kill them when not being looked at, but I also do not want it to travel though walls (so if it is locked in a room and cannot normally get to the player, it won’t be able to teleport).

If I can’t do that for teleporting, then could I do that for normal movement (sliding, I guess)?

(User was banned for this post ("Wrong section" - Gran PC))

I dont fully understand what you mean, but i think just you just need to use trace to see if the two players can see each other.

Sorry. I did word that a bit weird, didn’t I? What I meant was, I want to code an object that will teleport to the player and kill them when they aren’t looking in its direction. Is there a way to make it so that the object will not teleport to the player if it cannot reach them by normal means?

Then yeah, trace would be your best bet. Make it when the trace from the player to the object is broken the teleport happens. However for checking if its possible to get there via normal means then you would have to do some NPC pathfinding, ile try to find some wiki links later.

Edit: Try this?

That might just work, now all I have to do is figure it out.

Could just make an snpc to do this, but then it would only work on noded maps.