Minecraft Redstone delay that only works if active for 5 seconds but turns off when not active

Solution 1:

I've found a solution enter image description here Ok, so the two command blocks linked to the clock are placing and removing the block between the comparator and the repeating command block. the command block is testing where if someone is standing on the quartz. the command block that is linked to gives everyone XP. it does this as long as someone is standing on the block and cancels if someone isn't. What I wanted was for someone to stand on a block, and it kept on giving them XP. but the problem with just having it test for and then send out a signal is that even when they aren't standing on it, they still get the XP. but if I make it a one-time thing and check it constantly, then it will work. I am sorry everyone for the confusion I gave you. So in the end, using scoreboards are the best way to have a delay that can be stopped immediately.