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

How do i check if a bool value is changed to false or the value is false to begin with?

Asked by 5 years ago

How do i check if a bool value is changed to false or the value is false to begin with without copy and pasting the code (too much code to copy and paste and wouldn't be efficient) e.g:

BoolValue.Changed:connect(function(NewValue) 
    if NewValue == false then
    --Lots of code
    end
end)


if BoolValue == false then
    --Lots of code (exact same as above)
end

How would i join these together for efficiency therefore considerably lowering the script line count?

0
i really dont wanna copy and paste the code as it would turn the script into 600 lines instead of 300 plus i need to copy and paste this script multiple times and change a few values as it applies to other scenarios LordOfWatermelons 27 — 5y
0
NVM ive used bindable function to make the script line considerably lower LordOfWatermelons 27 — 5y

1 answer

Log in to vote
1
Answered by
Cyrakohl 108
5 years ago
Edited 5 years ago

If you want to check if it has changed then try this checks at a wait time of however you want it checks if the bool is false

local Bool = false

While wait() do 
 if Bool == false then
          print(“Boolean is false..”)
end
       end 
0
while true do is not capitalized User#23365 30 — 5y
Ad

Answer this question