Im not able to insert a table into a existing quest table. I use functions todo all of these. this is according to my developer, but he doesn’t have dev forum access.
CLICK TO GET QUEST GIVER
local part = script.Parent
local click = part.ClickDetector
local questSystem = require(game:GetService("ServerScriptService"):WaitForChild("QuestSystem"))
click.MouseClick:Connect(function(plr)
local questData = {
id = plr.UserId;
name = "test quest";
reward = {
rewardType = "badge";
val = 638496704;
};
objectives = {
["1"] = {
name = "collect 500 blue bricks";
progress = 0;
goal = 500;
};
["2"] = {
name = "kill 10 people";
progress = 0;
goal = 10;
};
["3"] = {
name = "collect 500 red bricks";
progress = 0;
goal = 500;
}
}
}
local thing = questSystem:RegisterQuest(plr,questData)
end)
QUEST FUNCTION (inside a module)
function module:RegisterQuest(plr,questData,overwrite) --creates a new quest from the provided quest data
if quests[plr.UserId] == nil then quests[plr.UserId] = {} end
if quests[plr.UserId] ~= nil and overwrite == false then
module:OverwriteQuest(plr)
print("quest already ongoing")
return "Quest already ongoing!"
end
table.insert(quests,questData)
print("recieved player: "..tostring(plr) or "nil")
print("quests table: "..tostring(table.unpack(quests)) or "nil")
for _,v in pairs(quests) do
if v.id == questData.id then
print("players quest table: "..tostring(quests.v) or "nil")
return v
end
end
error("unable to add and find player's quest table!")
--localSound:FireClient(plr,questData.sound)
end
any help is appreciated. thanks. this is kinda urgent btw.