Error Log:
▶ {...} - Server - Script:3
16:21:24.977 ReplicatedStorage.Quests:23: attempt to index function with 'Name' - Server - Quests:23
16:21:24.977 Stack Begin - Studio
16:21:24.977 Script 'ReplicatedStorage.Quests', Line 23 - function CompleteQuest - Studio - Quests:23
16:21:24.977 Script 'ServerScriptService.Script', Line 4 - Studio - Script:4
16:21:24.977 Stack End - Studio
19:04:58.309 Disconnect from ::ffff:127.0.0.1|57879 - Studio
I can print the Quest Info with a function, but when I try to change Quest Info with another function, it errors.
Heres my module “Quests”:
local Quests = {
[1] = {
Name = "One Step Forward",
Requirements = {{"Join", 1},{"CollectApple", 1}},
Rewards = {
["ItemApple"] = 5,
["Money"] = 100
},
Progress = 0
}
}
function Quests:GetQuestData(Quest)
for i, v in pairs(Quests) do
if v["Name"] == Quest then
return v
end
end
end
function Quests:CompleteQuest(Quest)
for i, v in pairs(Quests) do
if v["Name"] == Quest then
v["Progress"] = 100
local Apples = table.find(v["Rewards"], "ItemApple")
local Test = table.find(v["Rewards"], "Honey") -- Won't show up, which is good!
if Apples == "ItemApple" then
print("Item Rewarded")
end
if Test == "Honey" then
print("honeYYY")
end
end
end
end
return Quests
Heres how I fire the Module:
local Module = require(game.ReplicatedStorage.Quests)
local QuestData = Module:GetQuestData("One Step Forward")
print(QuestData)
Module:CompleteQuest("One Step Forward")
I use a server script and I’ve tried 6 solutions and nothing has worked out for me.