Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you make a proximity sensor on an NPC?

Asked by
dirk2999 103
5 years ago

I know this is not a request site but I'm not sure where to start. My game is FE obviously. Basically I have an NPC when you walk up to them I want a chat to show up, a chat GUI that I create, and I'm not sure where to start

0
Not a request site! User#19524 175 — 5y
0
Not looking for someone to make the script for me, just to point me in the right direction. dirk2999 103 — 5y
0
I’ll help, but what do you mean by proximity sensor. User#19524 175 — 5y
0
I have a NPC, when a player walks up to the NPC I want to move the camera to focus on the NPC and bring up a GUI that I created. I can do the camera and GUI, just don't know how to grab the player. dirk2999 103 — 5y

1 answer

Log in to vote
1
Answered by
T1mes 230 Moderation Voter
5 years ago
Edited 5 years ago

You can put an invisible block around the npc, anchor it, and use the .Touched event.

A less efficient way is continually check the magnitude of both the player and the npc to trigger the encounter.

If you aren’t familiar with magnitude it’s how far the two positions are apart.

The way to use magnitude is (position1 - position2).Magnitude

Hope this helps.

0
Thank you! dirk2999 103 — 5y
Ad

Answer this question