Loop acting weirdly

I have no idea how to explain it show ill just show a video and code :frowning:


Nevermind, I split the two loops and now it seems to work as intended

I lied, turns out its still acting the same way

why not just put the while loops out the function and rather have while true do
have while lightswitch.Toggled.Value == true do

Try adding a debounce to it.

local debounce
Event:Connect(function()
   if debounce then
      return
   end
   debounce = true
   -- Your code...
   -- ...
   
   -- At the end set debounce as false or nil
   debounce = false
end
1 Like