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

How do I check for multiple values and if one is not true then it's false?(More in description)

Asked by
ElBamino 153
2 years ago

I'm not exactly sure how to word the title so I hope the description and my idea of how it's going work will help. How do I check for more than one value as is equal to true then andif one or more is not then? I would like to run this constantly checking the values. Thank you for the help in advance. I appreciate it.

local BCV = game.Workspace.CP.BC
local GuestV = game.Workspace.CP.Guest
local TixV = game.Workspace.CP.Tix
local cpl = game.Workspace.CPL

while true do
    wait(1)
        if BC.Value == true and Guest.Value == true and Tix.Value == true then
        cpl.Fire.Enabled = true
            elseif --I don't know if there's anything I need to add to check if any of the values are false
            cpl.Fire.Enabled = false
end
end
end

1 answer

Log in to vote
1
Answered by 2 years ago

Well there a two ways of doing this. A long way, and a short way. The long way is more specific than the short way.

Here is the short way

local BCV = game.Workspace.CP.BC
local GuestV = game.Workspace.CP.Guest
local TixV = game.Workspace.CP.Tix
local cpl = game.Workspace.CPL

while true do
    wait(1)
        if BC.Value == true and Guest.Value == true and Tix.Value == true then
        cpl.Fire.Enabled = true
            else
            cpl.Fire.Enabled = false
end
end
end

Here is the long way

local BCV = game.Workspace.CP.BC
local GuestV = game.Workspace.CP.Guest
local TixV = game.Workspace.CP.Tix
local cpl = game.Workspace.CPL

while true do
    wait(1)
        if BC.Value == true and Guest.Value == true and Tix.Value == true then
        cpl.Fire.Enabled = true
            elseif  BC.Value == false or Guest.Value == false or Tix.Value == false then
            cpl.Fire.Enabled = false
end
end
end

Hope this helped!

0
Thank you, I appreciate the help! ElBamino 153 — 2y
0
Sorry it took so long to accept the answer, I was having problems with my internet last night. ElBamino 153 — 2y
Ad

Answer this question