Why does my script not detect the local before part?
Like I want it to do something when all of those values are false but it doesent work
That’s making a table of booleans, not checking if they’re all false. It would look like this:
{false, true, false}
You can just use the and
keyword between them instead of using {}, e.g.:
value1 and value2 and value3
What do you mean by this? (30 letters)
When you did:
{
game.Workspace.Configuration.Presets.Low.Value == false,
game.Workspace.Configuration.Presets.Normal.Value == false,
game.Workspace.Configuration.Presets.High.Value == false
}
It’s not giving you a neat boolean value back.
For this example, let’s say Low is true, Normal is false, and High is true. If this is the case, it’s giving this table back:
{true, false, true}
If you want it to just give you one value back, you can do this:
local before =
game.Workspace.Configuration.Presets.Low.Value == false and
game.Workspace.Configuration.Presets.Normal.Value == false and
game.Workspace.Configuration.Presets.High.Value == false
Using our same values from before, it would just give you false
(since High and Low are true)
{} is for tables, not for checking values.
just use indexs.
Replace:
if before then
With:
if not before[1] and not before[2] and not before[3] then
Wow you fixed my entire plugin! Thank you so much!
This is less efficient since it’s constructing a table, indexing them, then checking them rather than checking them initially and using that
No problem! If you have any more issues, feel free to make another topic (unless it’s the same issue, then reply here).
Anyway would fix this problem, I fixed it by doing his way instead of my way.