hi = false
local part = script.Parent.eeee
function hit ()
if part.Reflectance == 0 then
if not hi then
hi=true
end
part.Reflectance = .1
print ("1")
wait(3)
hi = false
--here down is the debounce that doesnt work VVVV
else
if not hi then
hi = true
part.Reflectance = 0
print ("2")
wait(3)
hi = false
end
end
end
script.Parent.Lever1.ClickDetector.MouseClick:Connect(hit)
✓ ANSWER ACCEPTED
i have made a else script and debounced it but only the first function and not the second, why?
1 answer
✓ Accepted answer
sorry but the script you made is over complicated here is the revamped version of that script and it should work
hi = false
local part = script.Parent.eeee
script.Parent.Lever1.ClickDetector.MouseClick:Connect(function(hit)
if part.Reflectance == 0 then
if hi == false then
hi = true
end
part.Reflectance = .1
print ("1")
wait(3)
hi = false
else
if hi == false then
hi = true
part.Reflectance = 0
print ("2")
wait(3)
hi = false
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
still doesnt work
all fixed sry just had to edit it a bit