I am new to scripting and i tried to make a simple colour changing tile script with a debounce but it doesnt work.
local part = script.Parent
local debounce = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent then
if not debounce then
debounce = true
part.Material = "Neon"
part.BrickColor = BrickColor.Random()
debounce = false
end
end
end)
I looked at the wiki to try learn debounce but i found it a bit confusing. Any help would do explaining debounce and how to fix my script

2 comments
The debounce isn’t performing an actual preventive instruction. Add a wait(timeNumber) before calling debounce = false
Thanks Feahren! It worked