Look Line 126
local ReplicatedStorage = game:GetService("ReplicatedStorage") local QuestLibraries = ReplicatedStorage:FindFirstChild("QuestLibraries") -- Libraries -- local Dialogs = require(QuestLibraries:FindFirstChild("Dialogs")) local Quests = require(QuestLibraries:FindFirstChild("Quests")) -- Variables local QuestGUI = ReplicatedStorage:FindFirstChild("QuestDialog", true) local QuestTag = ReplicatedStorage:FindFirstChild("QuestTag", true) local Quest = script.Configurations.Quest.Value local Enabled = script.Configurations.QuestEnabled.Value -- create quest folder function -- function StartQuest(QuestID, Quest_Data) local folder = Instance.new("Folder") folder.Name = QuestID local number = Instance.new("IntValue") number.Name = "Number" number.Parent = folder local goal = Instance.new("IntValue") goal.Name = "Goal" goal.Value = Quest_Data["Nmbr"] goal.Parent = folder return folder end ---- Create Quest Tag Function ---- function CreateTag(QuestID, Quest_Data) local Tag = QuestTag:Clone() Tag.Name = QuestID Tag.Status.Text = "0 / " .. Quest_Data["Nmbr"] Tag.Title.Text = " " .. Quest_Data["Name"] return Tag end 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 ---- GUI Parts ---- local GUI = QuestGUI:Clone() local Main = GUI.Hold.Hold.Frame local GUI_Name = Main:FindFirstChild("Name", true) local Decline_Btn = Main:FindFirstChild("Decline",true) local Accept_Btn = Main:FindFirstChild("Accept",true) local NPC_Dialog = Main:FindFirstChild("NPCDialog",true) ---- Quest/Dialog Tables ---- local Dialog_Data = Dialogs.dialog[Quest] local Quest_Data = Quests.quests[Quest] ---- Set Defaults ---- GUI_Name.Text = " " .. script.Parent.Name Decline_Btn.Text = Dialog_Data["NoQuest"]["EXIT"] GUI.Parent = PlayerGui -- Put Gui into PlayerGui ---- Get number of dialogs ---- local num_of_dialogs = 0 for key, value in pairs(Dialog_Data["NoQuest"]) do if key ~= "EXIT" then num_of_dialogs = num_of_dialogs + 0.5 end end ---- go through dialog ---- local OnQuest = false local IsComplete = false local dialog_num = 1 local Quest_Folder = nil if Player:FindFirstChild(Quest) ~= nil then Quest_Folder = Player:FindFirstChild(Quest) OnQuest = true if Quest_Folder.Number.Value >= Quest_Data["Nmbr"] then IsComplete = true end end if OnQuest then Accept_Btn.Visible = false if IsComplete then NPC_Dialog.Text = " " .. Dialog_Data["Quest"]["COMPLETE"] Decline_Btn.Text = "Thanks!" ---- Finish Quest: Get Rewards, Remove Quest Folder ---- Decline_Btn.MouseButton1Click:connect(function() local leaderstats = Player:FindFirstChild("leaderstats") leaderstats.Beli.Value = leaderstats.Beli.Value + Quest_Data["Beli"] leaderstats.XP.Value = leaderstats.XP.Value + Quest_Data["XP"] Quest_Folder:Destroy() end) else NPC_Dialog.Text = " " .. Dialog_Data["Quest"]["INCOMPLETE"] Decline_Btn.Text = "Oh, right...." end else Accept_Btn.MouseButton1Click:connect(function() if dialog_num ~= num_of_dialogs then dialog_num = dialog_num + 1 NPC_Dialog.Text = " " .. Dialog_Data["NoQuest"]["NPC" .. dialog_num] Accept_Btn.Text = Dialog_Data["NoQuest"]["RES" .. dialog_num] else local GUIContainer = Player.PlayerGui.QuestsGUI:FindFirstChild("Container") local Quest_Folder = StartQuest(Quest, Quest_Data) Quest_Folder.Parent = Player local Quest_Tag = CreateTag(Quest, Quest_Data) Quest_Tag.Parent = GUIContainer GUI:Destroy() end end) end end end end)
Closed as Not Constructive by TheeDeathCaster
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?