[SOLVED] My gui still clones after accepting quest

Hi scripters,

i am making my own quest system that i am almost finished with. Now i just need to do that the quest gui in the quest menu will not duplicate. Now it is duplicating like that you click on the accept button more than 1 time (I know that i could make the accept button dissapear, but i still need to check if the quest was accepted or completed.) Here’s my code:

	if questModul.settings[quest]["Completed"] == true or questModul.settings[quest]["Accepted"] == true then
		print("Quest already finished or accepted!")
		questModul.settings[quest]["Accepted"] = true
		local questFrame = player:FindFirstChild("PlayerGui").QuestGui.QuestFrame
		local questWindow = questFrame:FindFirstChild("Sample"):Clone()
                questWindow.Visible = true
		questWindow.Parent = questFrame
		questWindow.Name = quest
		questWindow.QuestName.Text = quest
		questWindow.NPCname.Text = questModul.settings[quest]["Npc"]
		questWindow.QuestDescription.Text = questModul.settings[quest]["Description"]
1 Like

Seems like a simple debounce can fix your problem.


Ok i know what debounce is but where should i put it?

Put the debounce where you have the input, so if it’s a GUIButton put it at the start of the trigger event.

How would that help the problem? I just need something like cloning a modul script and changing a bool value to true. Or making a variable for each player that can be changed.

I think I misunderstood the issue. I thought it was that you wanted to prevent the player from clicking the accept button multiple times.

Oh ok :smiley: It’s ok doesn’t matter

I will just make a folder in each player called: “AcceptedQuests” and “CompletedQuests” and ill add a bool value for every quest in the game.