p = script.Parent --Part in workspace
db = false
p.Touched:Connect(function(hit)
hum = hit.Parent:FindFirstChild('Humanoid')
if db == false then
debounce = true
hum.Health = hum.Health - 10
wait(2)
debounce = false
end
end)
It also for some reason gives me a error 22:15:57.427 - Workspace.Part.Script:7: attempt to index global 'hum' (a nil value)

4 comments
local variables make absolutely no difference from standard variables
i've done a bunch of tests on local variables and they are exactly the same
No. They are not. Usage of global variables is bad practice; it makes your code messy.
Local variables are also only slightly faster for each access than a global.