Hello guys !
Im here today because I am having a problem with my quest system, when the player complete a quest it works perfectly but the 2nd quest he complete the function is called 2 times and the reward are given 2 times so. When I complete 3 times a quest that give me 3 times the rewards
questProgress:GetPropertyChangedSignal("Value"):Connect(function()
if questTask.Value ~= "" then
if questProgress.Value >= questGoal.Value then
plr.PlayerGui:WaitForChild("Quests").Canvas.Main.Details.ClaimBTN.Visible = true
plr.PlayerGui:WaitForChild("Quests").Canvas.Main.Details.ClaimBTN.ClaimBTN.MouseButton1Click:Connect(function()
local questnum = plr:WaitForChild("Quest"):FindFirstChild(questGiver.Value):FindFirstChild(questNumber.Value)
questnum.Value = true
if plr:WaitForChild("BoostCount").Value == plr:WaitForChild("MaxBoost").Value then
local template = plr.PlayerGui.PopUpGUI.MainFrame.Template:Clone()
template.Parent = plr.PlayerGui.PopUpGUI.MainFrame
template.Text = "You can't store more boosts !"
template.Visible = true
game.ReplicatedStorage.Remotes.PlaySound:FireClient(plr, "WrongSFX")
wait(1.5)
template:Destroy()
else
plr:WaitForChild(questRewardBoostFolder.Value):WaitForChild(questRewardBoost.Value).Value += questReward.Value
plr.PlayerGui:WaitForChild("Quests").Canvas.Main.Details.ClaimBTN.Visible = false
remotes.StoreBoost:FireClient(plr, questRewardBoost.Value)
for i, v in pairs(quest:GetChildren()) do
if v:IsA("StringValue") then
v.Value = "You finished the quest !"
elseif v:IsA("NumberValue") or v:IsA("IntValue") then
v.Value = 0
end
end
wait(3)
for i, v in pairs(quest:GetChildren()) do
if v:IsA("StringValue") then
v.Value = ""
elseif v:IsA("NumberValue") or v:IsA("IntValue") then
v.Value = 0
end
end
end
end)
end
end
end)
idk if i am clear say it if im not clear ill try to reexplain it
Here is my code if you guys can help me i’ll really appreciate it ![]()