This is the script with the debounce:
local hasFlag = false
local Thing = true
local DeBounce = false
function accessBackpack(hit)
if hit and hit.Parent then
local chara = hit.Parent
local player = game.Players:GetPlayerFromCharacter(chara)
local backpack = player:FindFirstChild("Backpack")
local flag = backpack:FindFirstChild("RedFlag")
if flag and flag.Parent == backpack and hasFlag == true then
return "RedFlag"
else
return print("No flag")
end
end
end
script.Parent.RedFlag.Handle.Touched:Connect(function(char)
if DeBounce == false then
DeBounce = true
hasFlag = true
if char and char.Parent then
local player = game.Players:GetPlayerFromCharacter(char.Parent)
if player then--check if they are a player
if char.Parent:FindFirstChild("Humanoid") then
if char.Parent.Humanoid.Health > 0 then--if they are still alive
print(player.Name .. " has the Red Flag!")
char.Parent:FindFirstChild("Humanoid").Died:Connect(function()
print("Person who has flag died!")
if char.Parent:FindFirstChild("RedFlag") or accessBackpack(char) and hasFlag == true then --if they die and they have the flag in their hand or backpack
hasFlag = false
local FlagClone = game:GetService("ServerStorage"):WaitForChild("RedFlag"):Clone()--the flag gets cloned and put into workspace
FlagClone.Parent = game.Workspace
FlagClone.Handle.CFrame = CFrame.new(char.Parent.Head.Position)
FlagClone:WaitForChild("Handle").Anchored = true
Thing = false
wait(3)
Thing = true
FlagClone.Handle.Touched:Connect(function()
wait(Thing)
if FlagClone.Parent.Parent == game.Workspace then
FlagClone.Handle.Anchored = false
end
end)
end
end)
end
end
end
end
end
DeBounce = false
end)
The problem is that nothing works after line 18/19 (around there) with the debounce. I've tried print statements and output says no errors. Please help me fix this problem. Btw, I just started learning about debounces today, so I'm not very good at it.

4 comments
Read my bio.
Is it indenting properly lol
Just put Debounce = true and if Debounce = true then Debounce = false. Basically switch it.
So just that on line 20?