How to make a quest system

What do i want to achieve?

i want to make a quest system. Which should work like this: you go up to a npc and then you will get a quest from the npc (i want the quests to be like: Kill 5 players, Get 10 Money)

What is the issue?

I can’t do it

What solutions have you tried so far?

I tried looking on youtube, Developer Forum but they didn’t do the thing that i want it to. (or i didn’t see it)


Sorry but, you should learn and write your own script. You can’t just ask for an entire script as the starter post suggests.

1 Like

oh ok… but can you tell me atleast how to start learning?

1 Like

Yes of course I can, what do you need help with in scripting?

1 Like

i just want to learn on how to script things by myself like this quest sytem

1 Like

Well, for your quest system, create a datastore. Then make a tool that tracks how many kills you’ve gotten on the client. This number will tell the NumberValue inside the player to change to +1. Now, On a LocalScript, you would do an if statement in a while true do checking if the players NumberValue = 5 or < 5, This would grant the player the specific amount of money, you can check out a tutorial on youtube, or I can create the script for you when I have time.

1 Like

In principle, first you need to record how many times a player has killed. Once you can record that (maybe a NumberValue stored in server storage) I advise using a datastore as lolman has suggested. Record how many kills a player has, so if they haven’t completed the quest and come back another day, they can finish the quest. There are many tutorials online for datastores, so don’t sweat!

In terms of talking to the NPC, you will need to make dialogues and detect when the player has selected a dialogue choice. Once detected, you would do a simple if, then check.

I would advise watching some tutorials on the basics of scripting in Lua first. If you do need help in certain parts of your scripting, don’t hesitate to ask for help! Just make sure to have a go first.

I wouldn’t have this script run on the client. Somebody could just set the amount of kills to the required amount. Instead, what you should try doing is having a BindableEvent on the server side that fires every time an enemy is killed. The best way to do this would be something as follows:

- - Just put the enemy humanoids here when they are spawned in
local EnemyHumanoids = {}

local BindableEvent = “Put your bindable event here”

for i, Humanoid in pairs (EnemyHumanoids) do
    if Humanoid.Health <= 0 then
        EnemyHumanoids[i] = nil

        - - Put any other stuff you need to do when an enemy is dead

Essentially, we looped over any humanoid, checked if they are dead, and then sent the event.

You then can process the event in another script, however, you will need the player that killed them. There are once again, multiple ways of going about this, and they will all depend on how you are handling kills with weapons. The best advice I can give you for this one is that you could have a string value called Killer, and when a weapon attacks an enemy, before applying damage, if that attack will kill them, change the killer value to the player. You would pass a parameter through the BindableEvent like so:


Now that we have this done, it is all a matter of on the server, checking if the player has any active quests running that require that specific enemy killed, then increment the enemies killed on that question by one. Keep in mind that you will need to pass the enemy type as well if you have more than one type of enemy.

I hope this helped, let me know if you have any more questions.