A shopkeeper that actually answers questions about your items — "which sword is best against armor?" — feels alive in a way a static menu never does. Here's the minimal version.
Give the NPC your catalog
Put your item list in the system prompt so the NPC only talks about things that exist:
local ai = Cortex.new("YOUR_KEY")
local persona = [[
You are Marta, a cheerful blacksmith's apprentice. You sell:
- Iron Sword (balanced), Warhammer (slow, heavy damage), Dagger (fast, weak).
Answer player questions in one or two short, in-character sentences. Never invent items.
]]
local reply = ai:ask(persona, playerMessage)
Make it hold up in a real game
- Per-player memory so Marta remembers what a player already asked.
- A cooldown per player so nobody can spam her.
- Filter her replies before showing them.
With the Cortex kit that's an NPC object with memory and moderation built in:
local marta = ai:npc({ personality = persona, moderate = true })
local reply = marta:say(player, playerMessage)
Free and open source: https://github.com/cortex-rbx/roblox-ai-kit
Top comments (0)