Trouble With Making an NPC Dialogue

Hello Roblox Developers and Scripters!

What do you want to achieve?
I want to be able to make an NPC dialogue and then have the player choose something to continue the conversation.

What is the issue?
I am sending the dialogue AND choices in two or one parameters in a Remote Event, I don’t know how to include an entire timeline of dilemmas into one table lol. If there is an easier way, please tell me!

What solutions have you tried so far?
I’ve tried making tables in tables in tables in tables in ta-- you get it, but that will take WAY to long.

--[[
Vocabulary (because I'm trying to get used to comments lol):
	PP: Proximity Prompt
	Ev: Event
	waitText: "Wait Text" is just like tips and tricks or fun facts
	trans: transition
	char: character (the player's character)
	HumanoidRootPart: the core part of the player; unaffected by animations (X and Z axis are always the same)
	CFrame: Direction and position of a part
	Vector3: 3 dimensional space (size, position)
]]

local PP = script.Parent
local talkEv = game.ReplicatedStorage.Talk
local transScreenEv = game.ReplicatedStorage.TransScreen
local moveCameraEv = game.ReplicatedStorage.MoveCamera

PP.Triggered:Connect(function(plr)
	local char = plr.Character
	
	talkEv:FireClient(plr, --[[dialogue and choices here]])
	transScreenEv:FireClient(plr, '') -- Parameter 2 is the Wait Text (Basically visual elevator music lol)
	
	char.EnabledPP.Value = false
	char.Frozen.Value = true
	char.HumanoidRootPart.CFrame = PP.Parent.Camera.CFrame - Vector3.new(3, 0, 0) -- Teleports player behind the camera
	
	moveCameraEv:FireClient(plr, workspace.NPC.Torso.Camera, true)
end)

Is there any way to put multiple lines of speech (for the NPC) and multiple choices/responses (for the Player)? If you need any further information, just tell me!

Thank you! Have a blessed and great day/night! :slight_smile:

1 Like

Maybe have a one parameter that is the main dialog, and then another table with the responses, and their linked dialog trees? I’m not really understanding what you mean here.

Sorry if you didn’t understand what I was saying, I’d be willing to clarify if I got a response.

2 Likes

Oh, I think I solved it. Now I just have to script it. I will put this as solution if it’s successful.

I just put the dialogue as string values, labeled them “Text”, “Choice”, and “Exit” Text / Choice. I will just put the folder containing them into the parameter.

image_2022-09-25_203903446

1 Like