I’m trying to make a daily quest system and I have all the quests in a dictionary modulescript. The idea is that there will be 6 quests that reset every 24 hours and I will have these quests be picked at random and go into a table with no repeats so the same quest isn’t there twice but don’t really know how to do the random quest picking part.
What I have so far:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local QuestsDaily = require(ReplicatedStorage.Databases.QuestsDaily)
local dailyQuestsTable = {}
--putting just the name in the table for now
for i = 1, 2, 1 do
table.insert(dailyQuestsTable, QuestsDaily["Power Quests"][math.random(1, #QuestsDaily["Power Quests"])].Name)
table.insert(dailyQuestsTable, QuestsDaily["Punching Quests"][math.random(1, #QuestsDaily["Punching Quests"])].Name)
table.insert(dailyQuestsTable, QuestsDaily["Gathering Quests"][math.random(1, #QuestsDaily["Gathering Quests"])].Name)
end
print(dailyQuestsTable)
The output:
[1] = "Daily Training II",
[2] = "Daily Punching III",
[3] = "Daily Gathering II",
[4] = "Daily Training II", --repeat of 1
[5] = "Daily Punching IIII",
[6] = "Daily Gathering II" --repeat of 3