while true do wait() if v.Value ~= 1 then print("bye") repeat wait() until v.Value == 1 end end
At the beginning, it was working once. Now, this loop works for 2 times and then it stops responding to anything. In studio, it works normally. The script is a LocalScript.
Changed
event exists, to check if a property changes. The good thing is that the Changed
event fires only when a property changes, so no code is running every 0.0299 seconds or however long the default wait time is.v.Changed:Connect(function() wait() if v.Value ~= 1 then print("bye") end end)