GameDevGenie logo GameDevGenie

How to Make NPC Dialogue in Roblox

Updated

Non-Player Characters (NPCs) bring immersion, quests, and storytelling to your Roblox experience. From shopkeepers to quest givers, interactive conversations guide players through your world. Here is how to create smooth dialogue systems from scratch.

Step 1: Set Up the NPC Model and ProximityPrompt

In Roblox Studio, insert an R15 or R6 character rig from the Avatar tab. To prompt interaction when players approach:

  1. 1 Locate the NPC model in the Explorer and find its `HumanoidRootPart`.
  2. 2 Click the + icon beside `HumanoidRootPart` and insert a ProximityPrompt.
  3. 3 In the Properties panel, set `ActionText` to “Talk”, `ObjectText` to the NPC’s name, and `HoldDuration` to 0.5 seconds.

Step 2: Generate the Dialogue Script

Writing dynamic branching conversations with variables and quest conditionals can quickly become complex. You can generate ready-to-run dialogue scripts and character lines using our NPC Dialogue Generator.

Step 3: Trigger the Dialogue UI (Client Script)

When the ProximityPrompt is triggered, open your dialogue ScreenGui and display the text. Add a LocalScript inside your dialogue frame:

local prompt = workspace.NPC.HumanoidRootPart:WaitForChild("ProximityPrompt")
local dialogueFrame = script.Parent
local textLabel = dialogueFrame:WaitForChild("DialogueText")

local message = "Greetings, traveler! Are you ready to embark on this quest?"

prompt.Triggered:Connect(function()
	dialogueFrame.Visible = true
	textLabel.Text = ""
	
	-- Typewriter effect
	for i = 1, #message do
		textLabel.Text = string.sub(message, 1, i)
		task.wait(0.03)
	end
end)

Need a stylized RPG dialogue frame or quest window? Use the Roblox UI Maker to generate sliced UI containers ready for ScreenGuis.

Roblox NPC Dialogue FAQ

What is a ProximityPrompt in Roblox?

A ProximityPrompt is a built-in Roblox interaction widget that displays a key prompt (such as [E] to Interact) when player avatars approach an in-game object.

How do I add a typewriter sound effect to dialogue?

Play a short click sound from your SoundService on each iteration of the text typing loop using Sound:Play().

Can NPCs award items after finishing dialogue?

Yes. Fire a RemoteEvent from the client to the server when the final dialogue choice is selected to grant items or currency safely.

More Roblox Guides