Hey there,
I’ve been really struggling with this code, I’m trying to request information from a main folder that contains other folders with values and I want to get that information from the folder “quest1” to the “quest4” folder and it displays it in a GUI.
Any kind of help or feedback would be really appreciated
Thank you for reading,
The code:
local questchoice = {}
for i, x in pairs(game.ReplicatedStorage.Quests:GetChildren()) do
table.insert(questchoice, x.Name)
end
table.sort(questchoice, function(A, B)
return tostring(A.Name) > tostring(B.Name)
end)
local boolean = script.Parent.Ongoing
local quest = 1
while(1) do
if boolean.Value == false then
boolean.Value = true
local picked_value = questchoice[quest]
local frame = script.Parent.Frame
local info = game.ReplicatedStorage.Quests:FindFirstChild(picked_value)
game.ReplicatedStorage.QuestData:FireServer(picked_value, info.TypeOfQuest.Value)
script.Parent.Display.QuestName.Value = picked_value
frame.QuestName.Text = info.QuestName.Value
frame.QuestType.Text = ('Quest Type: '..info.TypeOfQuest.Value)
script.Parent.Display.QName.Text = info.QuestName.Value
script.Parent.Display.Goal.Value = info.TypeOfQuest.AmountCollect.Value
if info.Reward.Value == true then
if info.Reward.Amount.Value > 0 and info.Reward.Currency.Value ~= '' and info.Reward.ObjectReward.Value == '' then
frame.RewardType.Text = 'Reward Type: Currency'
frame.Reward.Text = '+'..info.Reward.Amount.Value..' '..info.Reward.Currency.Value
quest = quest + 1
elseif info.Reward.ObjectReward.Value ~= '' and info.Reward.Amount.Value <= 0 then
frame.RewardType.Text = 'Reward Type: Object'
frame.Reward.Text = 'Object: '..info.Reward.ObjectReward.Value
quest = quest + 1
elseif info.Reward.Amount.Value > 0 and info.Reward.Currency.Value ~= '' and info.Reward.ObjectReward.Value ~= '' then
frame.RewardType.Text = 'Reward Type: Object/Currency'
frame.Reward.Text = 'Object: '..info.Reward.ObjectReward.Value..'| +'..info.Reward.Amount.Value..' '..info.Reward.Currency.Value
quest = quest + 1
end
else
frame.RewardType.Text = 'Unrewardable'
quest = quest + 1
end
end
end
What the folder looks like: