Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-6

QuestGUI is not a valid member of PlayerGui how do i fix this!? [closed]

Asked by
IcyMizu 122
6 years ago

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)

0
This is from a tutorial. green271 635 — 6y
0
This isn't even secure. Everything is done on the client, and you didn't script it at all. green271 635 — 6y
0
typing the script from the video, doesnt mean "you scripted all of it, 100% original" User#23365 30 — 6y
0
:xdd: "proffesional" fix your spelling User#19524 175 — 6y
View all comments (5 more)
0
whew SummerEquinox 643 — 6y
0
You didn't even tell us the problem you are having..Downvote. Rinextel 291 — 6y
0
Any screenshot of output? No. Any screenshot of the Explore tab? No. Rinextel 291 — 6y
0
Cool 144 liness Zafirua 1348 — 6y
0
someone get this moderated speedyfox66 237 — 6y

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?