I'm creating a little touch part to demonstrate a database system, the idea being every time you touch the part you get 5 points. Since the roblox touch system is a bit finnicky, I need a debounce which is pretty simple. My code is as follows;
local debounce = true
TestPart.Touched:Connect(function(Part)
if debounce == true then
debounce = false
print('ok')
if Part.Parent:FindFirstChild('HumanoidRootPart') then
-- code is here
end
wait(5)
debounce = true
end
end)
When I touch this part the code doesn't run at all. Why is this happening and how can I solve it?

4 comments
what type of script is this, and where is it located?
Normal script in workspace
Is the script disabled? Did you specify a variable for the part in question?
can you add the variable TestPart in the question?