Print(number) = nil on tutorial

  1. What do you want to achieve?
    Im following this tutorial of a quest system. How to make a Quest System

  2. What is the issue?
    The number print out as nil but in the tutorial it print and im sure everything is the same.

  3. 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:
image

Server script location & code:
image

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:
image

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:
image

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.

You didnt pass a third argument to the client, only 2
image

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.