Interact with NPC once they reach front of line

Hello! I am making a Roblox game with a cashier system similar to Welcome to Bloxburg. I have created a line where NPCs wait until the cashier can take their order. How would I make it so when the NPC reaches the front of the line, a GUI pops up asking the cashier to select an item that they want? Any help is appreciated. Thank you! :slight_smile:

There are a few ways to do this.

  1. Using the Magnitude between the two humanoids
  2. Using a proximity prompt
  3. Using an indexing system. All the NPCs are in 2 folders - InQueue or OutQueue. They’ll be put into the former folder if they are in the queue and the latter if they are not. Then, using a table system, you can iterate or index through the table (InQueue:GetChildren()) and get the first NPC in InQueue.
  4. Give IntValues to every NPC. If they are in the queue, set this IntVal to their position in the queue.
1 Like

Thank you so much, it worked! :smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.