Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Robbot Npc Spawner Plugin Wiki › Guides › Trigger Custom Server Commands When Players Click an NPC

Trigger Custom Server Commands When Players Click an NPC

Assigning Commands to NPCs

NPCs can trigger any server command when right-clicked. This works for announcements, rewards, game modes, or custom plugins:

1. Stand where you want the NPC

2. Type /rbnpc to start creation

3. Choose your NPC's appearance and name

4. In the command field, enter the exact command you want executed (e.g., /say Welcome!, /give @s diamond, /gamemode creative @s)

5. Spawn the NPC

Testing and Troubleshooting

Right-click the NPC to test. The command should run immediately. If nothing happens:

  • Verify the command works when you type it manually
  • Check that you have permission to use that command
  • Ensure the command syntax is correct (spaces, spelling, parameters)
  • Use /rbnpclist to edit the NPC and double-check the command field

You can use @s to target the clicking player, making commands like rewards or teleports work for whoever interacts with the NPC.