I have added a debounce but it doesnt work and the output and script is rank 5 separate times
If you could help that'd be great
local Config1 = game.Workspace.Config
local Config = require(Config1)
local buttonPressed = false
script.Parent.Parent.Parent.Submit.MouseButton1Click:Connect(function()
if buttonPressed == false then
buttonPressed = true
script.Value.Value = script.Value.Value + 1
if script.Value.Value == Config.questionAmount + 1 then
local Value = script.Value.Value
game.ReplicatedStorage.Check:FireServer(Value)
else
script.Parent.Parent.Parent.Parent:TweenPosition(UDim2.new(-1, 0, 0, 0))
wait (1)
script.Parent.Parent.Parent.Parent.Position = UDim2.new(1, 0, 0, 0)
script.Parent.Parent.Parent.Question.Text = Config.questions[script.Value.Value]
script.Parent.Parent.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0))
local Ans = script.Parent.Text
for i,v in pairs(Config.Keywords[script.Value.Value - 1])do
if Ans:match(" "..v.." ") or Ans == v or Ans:sub(Ans:len()-(v:len() - 1),Ans:len()) == v or Ans:sub(1,v:len()) == v then
game.ReplicatedStorage.Pass:FireServer()
else
print "User failed question"
script.Parent.Text = ""
wait (5)
buttonPressed = false
end
end
end
end
end)

4 comments
Have you tried moving lines 28-29 to after the 'if buttonPressed == false then' statement?
would that not just disable to debounce immediately?
Add a wait after moving the lines.
There is a wait (5) at the bottom