Hello, I am making a script where if a player has a folder (in their hierarchy ex Player.Folder) then the script ends. I want to use :WaitForChild()
but I don’t want there to be an infinite yield, because if the player doesn’t have the folder then the code continues. How can I achieve this?
It keeps saying QuestProgress does not exist.
task.wait(4)
local Dialogue1 = game.Workspace.TriggerDialogue1.ProximityPrompt
local RS = game:GetService("ReplicatedStorage")
Dialogue1.Triggered:Connect(function(plr)
if not plr.QuestProgress then
local QuestProgress = Instance.new("Folder")
QuestProgress.Name = "QuestInProgress"
QuestProgress.Parent = plr
local playerData = plr
plr.PlayerGui.Dialogue.Enabled = true
local UI = plr.PlayerGui.Dialogue
local NPCNAME = "Pheonix"
local Dialogue = "Hey, you. I need a favor."
local Dialogue2 = "You see those guys there with the (color here) shirt?"
local Dialogue3 = "I need you to take out 10 of them. I'll give you 50 street credit to start you out."
UI.NPCname.Text = NPCNAME
for i = 1, #Dialogue do
UI.Dialogue.Text = string.sub(Dialogue, 1, i)
task.wait(0.05)
end
repeat task.wait()
until UI.Value.Value == true
for i = 1, #Dialogue2 do
UI.Dialogue.Text = string.sub(Dialogue2, 1, i)
task.wait(0.05)
end
repeat task.wait()
until UI.Value.Value == true
for i = 1, #Dialogue3 do
UI.Dialogue.Text = string.sub(Dialogue3, 1, i)
task.wait(0.05)
end
RS.Quests.Pheonix.GivePheonixQuest:FireServer()
else
local KC = plr.KillCount
if KC.Value >= 6 then
RS.Quests.Pheonix.FinishPheonixQuest:FireServer()
local UI = plr.PlayerGui.Dialogue
local NPCNAME = "Pheonix"
local Dialogue = "Thanks for that, 'ppreciate it."
local Dialogue2 = "Heres your 50 street cred, as I said earlier."
local Dialogue3 = "I'll let you know if I need anything else."
UI.NPCname.Text = NPCNAME
for i = 1, #Dialogue do
UI.Dialogue.Text = string.sub(Dialogue, 1, i)
task.wait(0.05)
end
repeat task.wait()
until UI.Value.Value == true
for i = 1, #Dialogue2 do
UI.Dialogue.Text = string.sub(Dialogue2, 1, i)
task.wait(0.05)
end
repeat task.wait()
until UI.Value.Value == true
for i = 1, #Dialogue3 do
UI.Dialogue.Text = string.sub(Dialogue3, 1, i)
task.wait(0.05)
end
end
end
end)