local Button = script.Parent.Button local Green = script.Parent.Green local Red = script.Parent.Red local LightHolo = script.Parent.Light local ClickDetector = script.Parent.Button:WaitForChild("ClickDetector") local debouce = true function off() if debouce == false then Button.CFrame = Button.CFrame * CFrame.new(0.063,0,0) print("2") debouce = true end end function on() if debouce == true then Button.CFrame = Button.CFrame * CFrame.new(-0.063,0,0) print("1") debouce = false end end ClickDetector.MouseClick:Connect(function() if debouce == true then on() end if debouce == false then off() end end)
i think its cos when debounce is true, it makes it false so when it moves to the next line it will show as false and change to true again.
try adding a return after like this i gues
ClickDetector.MouseClick:Connect(function() if debouce == true then on() return end if debouce == false then off() end end)
This should work!
local Button = script.Parent.Button local Green = script.Parent.Green local Red = script.Parent.Red local LightHolo = script.Parent.Light local ClickDetector = script.Parent.Button:WaitForChild("ClickDetector") local debouce = true function off() Button.CFrame = Button.CFrame * CFrame.new(0.063,0,0) print("off") debouce = true end function on() Button.CFrame = Button.CFrame * CFrame.new(-0.063,0,0) print("on") debouce = false end ClickDetector.MouseClick:Connect(function() if debouce == true then on() else off() end end)