So I made this script wich asks a module what kind of reward the player should get, i put some explaiining in the script. This is the serverscript.
for i,questCharacter in pairs(questCharactersFolder:GetChildren()) do -- quest character.Name = "Bob"
questCharacter.ProximityPrompt.Triggered:Connect(function(player)
local questNumber = table.find(questModule,questModule[questCharacter.Name]) -- quest number = nil
askQuestRemote:FireClient(player,questNumber) -- quest number should be th index
end)
end
This is the module
local quests = {
["Bob"] = {
name = "Neighbourhood Watch",
text = "This was a beautiful neighborhood until all these bandits came, could you get rid of them for me?",
enemy = {["Enemy"] = 5},
reward = {["Xp"] = 25}
}
}
return quests
And this is the local script:
askQuestRemote.OnClientEvent:Connect(function(questNumber)
local questCharacter = questModule[questNumber]
print(questCharacter,questNumber) -- prints nil,nil
questNameText.Text = questModule[questNumber].name
questText.Text = questModule[questNumber].text
background.Visible = true
end)