I am making a script for a quest system for my RPG, and I came across the annoying error that I always get.
19:46:16.909 - Workspace.Villager.NPC.QuestScript:28: attempt to index local 'Dialog_Data' (a nil value) 19:46:16.910 - Stack Begin 19:46:16.910 - Script 'Workspace.Villager.NPC.QuestScript', Line 28 19:46:16.910 - Stack End
Nil value.
I have no idea how to fix it and I have no real clue about what it is.
This is the small chunk of code that is the biggest problem:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local QuestLibraries = ReplicatedStorage:FindFirstChild("QuestLibraries")
local Dialogs = require(QuestLibraries:FindFirstChild("Dialogs"))
local Quest = require(QuestLibraries:FindFirstChild("Quests"))
local QuestGUI = ReplicatedStorage:FindFirstChild("QuestDialog", true)
local Quest1 = script:FindFirstChild("Configurations") --These are the settings and such
local Quest = Quest1.Quest.Value
local Enabled = script.Configurations.QuestEnabled.Value
script.Parent.Torso.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") ~= nil then
local Player = game.Players:FindFirstChild(part.Parent.Name)
local PlayerGui = Player:FindFirstChild("PlayerGui")
if PlayerGui:FindFirstChild("QuestDialog") == nil then
local GUI = QuestGUI:clone()
local Main = GUI.Frame
local Decline_BTN = Main:FindFirstChild("No")
local Dialog_Data = Dialogs.dialog[Quest.Value]
local Accept_BTN = Main:FindFirstChild("Yes")
local NPC_Dialog = Main:FindFirstChild("MainText")
Decline_BTN.Text = Dialog_Data["EXIT"] --This is the error
Any help recieved is great. Thanks!

3 comments
'nil value' just means that the value doesn't exist. http://bfy.tw/2w5Y It probably has to do with your module script.
Thanks for the help, However I do not understand how to fix it.
Dialogs.dialog[Quest.Value] for some reason is equivalent to nil. We can't help much because we don't know the context.