Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
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

Log in to vote
0
Answered by 4 years ago

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)


0
still doesnt work IckyInvin5ible7 -70 — 4y
0
all fixed sry just had to edit it a bit IckyInvin5ible7 -70 — 4y
Ad

Answer this question