Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

i have made a else script and debounced it but only the first function and not the second, why?

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)

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)
 

2 comments

0

still doesnt work

0

all fixed sry just had to edit it a bit

This discussion is preserved as it was. New answers, comments, and votes are closed.