So I have a debounce in my touched function to stop the API from being overloaded. The code is as follows;
TestPart.Touched:Connect(function(Part)
local debounce = true
if debounce then
debounce = false
wait(5)
debounce = true
end
end)
I'm not sure why this is happening because it's a pretty simple/basic concept When the code is ran, the debounce doesn't do anything, and the code isn't ran every 5 seconds if the player touches it.

2 comments
Try moving the debounce variable outside of the function
I did but now the code doesn't run at all even if debounce is true