How to make a quest system?

So I’m working on a quest system and I think I’m on the right track I have the ui part of it down however I’m not really sure how I’d track the progress of it.

I made a module script for my quests I’ll probably end up changing it, but this is what I currently have

local quests = {
	
	["Test Quest 1"] = {
		["Description"] = "Kill 10 enemies",
		["Objective"] = "",
		["Rewards"] = {
			
		},
	},
	["Test Quest 2"] = {
		["Description"] = "Get 100 gold",
		["Objective"] = "",
		["Rewards"] = {

		},
	},
	["Test Quest 3"] = {
		["Description"] = "Get to level 5",
		["Objective"] = "",
		["Rewards"] = {

		},
	},
	
}

return quests

And so my plan is whenever the player accepts a quest I’ll add it to their player data so that I can save their progress and what quests they have, but how would keep track of their progress and like whatever or like check when they finished it? Like how would I check if the player reaches level 5 or if the player gets 100 gold etc do I have to make a large chain of ifs? or… hopefully that makes sense

1 Like

I think this should be under #help-and-feedback:scripting-support

OH my bad I made the mistake again! I had a draft open and forgot to change the category

1 Like

You could use Instance:GetPropertyChangedSignal if their money/level is a IntValue, here’s an example in a LocalScript:

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local Stats = player:WaitForChild("Stats")
local Money = Stats:WaitForChild("Money")
local Level = Stats:WaitForChild("Level")
Money:GetPropertyChangedSignal("Value"):Connect(function()
    --this code runs when the "Value" property of money changes
end)
Level:GetPropertyChangedSignal("Value"):Connect(function()
    --this code runs when the "Value" property of level changes
end)

I’m still kind of confused. So if I had 100 quests in the game would would I have to have like 100 different checks or something? Like if the player has this quest then if the player has this then complete it or like how would that work?

1 Like