Im making a Quest System. I have 3 module scripts containing the quest info. linesMod script stores text(strings) the quest giver is supposed to say. the questMod contains the rewards. and funMod loops through the lines.
The server script down below is in workspace. Its requiring all 3 modules to run. When a player has stepped on a part, the script below shows the text, checks to see if a player has a quest, if there on a quest, and if it has been complete. It also rewards the player when they are done.
The problem is whenever a player steps on the part the text that the quest giver is displaying shows to the whole server.
I want the script below to run on a local script so the quest giver is displaying different text for each individual person whenever that player clicked a part.
But im worried about exploiters. If i put the code below on a local script. im worried the player can see my module script questMod and change the exp and gold. How do I go about handling my modules on a local script so that they are safe from exploiters
local funMod = require(game.ServerScriptService.funModScript)
local billsMod = require(game.ServerScriptService.linesModScript)
local questMod = require(game.ServerScriptService.questModScript)
local Triggered = script.Parent
local debounce = true
local qGui = game.Workspace.Bill.SignModel.SignPart:WaitForChild("qgPartGui")
local showTitle = qGui.mainFrame.questTitleLabel
local showQuest = qGui.mainFrame.questLabel
Triggered.Touched:Connect(function(hit)
local char = hit.Parent
local humanoid = char:FindFirstChild("Humanoid")
if debounce and humanoid then
debounce = false
local plr = game.Players:FindFirstChild(char.Name)
local pStats = plr:WaitForChild("leaderstats")
local pVars = plr:WaitForChild("PlayerVars")
local PlayerStats = plr:WaitForChild("PlayerStats")
local pBeli = PlayerStats:FindFirstChild("Beli")
local pExp = PlayerStats:FindFirstChild("Exp")
local pOnQuest = pVars:FindFirstChild("OnQuest")
local pQuestComplete = pVars:FindFirstChild("QuestComplete")
local pRewardPaid = pVars:FindFirstChild("RewardPaid")
local pExpPaid = pVars:FindFirstChild("ExpPaid")
local pDone = pVars:FindFirstChild("QuestsDone")
local thisQuest = "quest"..tostring(pDone.Value)
local pItem = pVars:FindFirstChild("QuestItem")
local totalQuests = funMod.CountLines(questMod.Quests)
if pOnQuest.Value then -- player has a quest
if pQuestComplete.Value then -- player has completed the quest
if not pRewardPaid.Value then -- give player their reward
local allLines = billsMod.BillsLines[thisQuest].complete
local numOfLines = funMod.CountLines(allLines)
funMod.RunLines(allLines, numOfLines, showQuest, showTitle)
pBeli.Value = pBeli.Value + questMod.Quests[thisQuest].reward
pExp.Value = pExp.Value + questMod.Quests[thisQuest].Exp
pRewardPaid.Value = true
pExpPaid.Value = true
pOnQuest.Value = false
pDone.Value = pDone.Value + 0
if pDone.Value < totalQuests then -- there is another quest
pQuestComplete.Value = false
pRewardPaid.Value = false
pExpPaid.Value = false
pOnQuest.Value = false
else -- there are no more quests
pDone.Value = 0
end
end -- end pRewardPaid
else -- player has a quest, but not complete
showTitle.Text = questMod.Quests[thisQuest].title
local allLines = billsMod.BillsLines[thisQuest].onQuest
local numOfLines = funMod.CountLines(allLines)
funMod.RunLines(allLines, numOfLines, showQuest, showTitle)
end -- end pQuestComplete
else -- give player a quest
pOnQuest.Value = true
pItem.Value = questMod.Quests[thisQuest].item
showTitle.Text = questMod.Quests[thisQuest].title
local allLines = billsMod.BillsLines[thisQuest].allLines
local numOfLines = funMod.CountLines(allLines)
funMod.RunLines(allLines, numOfLines, showQuest, showTitle)
end
wait(5)
debounce = true
end
end)