-
What do you want to achieve?
Im following this tutorial of a quest system. How to make a Quest System -
What is the issue?
The number print out as nil but in the tutorial it print and im sure everything is the same. -
What solutions have you tried so far?
Ive looked over the code multiple times and i dont see the issue, also tried looking at dev forum but theres multiple nil issues that are all different situations.
Print:
Server script location & code:
local questModule = require(game:GetService("ReplicatedStorage"):WaitForChild("QuestSources").questModule)
local prompt = script.Parent.Torso:WaitForChild("ProximityPrompt")
local addQuestToGUI = game:GetService("ReplicatedStorage"):WaitForChild("QuestSources").AddQuest
local quest = "Find James' sunglasses"
local parentName = script.Parent.Name
local number = 1
local function findQuest()
for _,questInModule in pairs(questModule.Quests) do
if questInModule.Name == quest then
print("Found quest")
return questInModule
end
end
end
prompt.Triggered:Connect(function(player)
if game.Players:FindFirstChild(player.Name) then
local questFound = findQuest()
addQuestToGUI:FireClient(player, questFound, parentName)
end
end)
Also the prompt is in the torso.
Local script location & code:
local event = game.ReplicatedStorage:WaitForChild("QuestSources").AddQuest
event.OnClientEvent:Connect(function(questFound, name, number)
print(questFound.Name)
print(name)
print(number)
end)
Module script & code:
local questModule = {
Quests = {
Quest1 = {
Name = "Find James' sunglasses",
Reward = 50,
Currency = "Fortune"
}
}
}
return questModule
The only different thing i did if put the RE and module in a folder.