how would I go about making something like when you interact with a proximity prompt in an NPC, it opens a dialogue GUI and gives you a quest? what is the best way?
I think you’d be best using the proximitypromtps and using the events that trigger upon when you ineract with them. You could clone UIs when the person triggers it etc. Try to look it up on the developer.roblox.com site, good luck!
But how would I make the actual quest system? Saving quest data, detecting if the quest is finished, giving rewards after you go back to the npc, etc?
I suggest you look online. There’s plenty of resources which meet you needs.
For example:
Make a table for each level, or an table for all quests like this:
local table = {
["1"] = {
["Reward"] = 500,
["Description"] = "You have to go to island 15, to recieve 500"
},
["2"] = {
["Reward"] = 2500,
["Description"] = "Type lol in chat"
}
}
You can add more info on the table, then use a remote function/events to send player their daily/weekly quest
Note: You cannot use #table on quest table, as its a dictionary not a table of arrays
Okay, that’s cool but how would I add multiple rewards and save the quest progress?
Use data store to save quest, just listen
You can save tables,numbers,strings and tables of numbers and strings in DataStore, you cannot save instances (Objects), so try to make a table of quest done like this:
local questdone = {} -- you can fill this with tables or numbers or strings
local tabletoaddinquestsdone = {
{"QuestNumber"] = 1,
["QuestCompletedOn"] = os.date("*t")["day"]
}
table.insert(questdone,tabletoaddinquestsdone)
Now the table becomes:
local questsdone = {
{
{"QuestNumber"] = 1,
["QuestCompletedOn"] = os.date("*t")["day"]
}
}
-- Here you see the table we added don't have a name, it does not matter
Now you can use a remote event to send this table to server, then you use SetAsync
on data store to save the table with some name or userid
So I can do this for example:
remote:FireServer(questsdone)
?
Yes, you can do that
You can even send huge tables
I see, I will try this and let you know, thank you.
Edit: @Deadwoodx, how would I add multiple rewards? sorry I’m not professional with tables
Check https://developer.roblox.com because tables is a basic thing for scripting,but I don’t know how to explain it sorry
I will try to explain here too:
so tables is like a table irl
You can keep things on a table irl right, just like that in lua a table is a value, which can have tons of values
Example:
local numberchosen = 1
local letterchosen = h
print(numberchosen)
print(letterchosen)
-- prints as 1 and h
-- now table
-- we mix these two
local table = {"1","two"}
print(table)
-- prints {"1","two"}
you understood?