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

is there a way to use the Negative of If?

Asked by
Elixcore 1337 Moderation Voter
6 years ago
 if char:FindFirstChild("ForceField") then

how do i make this negative? for example:

if char:FindFirstChild("ForceField") == false then
0
i dont understand what you are you asking how to disable force feild mellowantyt 0 — 6y
0
no, is there a way to say for example: if you don't find a forcefield then do this Elixcore 1337 — 6y

2 answers

Log in to vote
3
Answered by 6 years ago

Just type "not" after if

if not char:FindFirstChild("ForceField") then
0
^^ oSyM8V3N 429 — 6y
0
tried already and it doesn't work because findfirstchild returns nil Elixcore 1337 — 6y
1
not (nil) evaluates to true in lua 5.3.4! And in ROBLOX Studio! @Elixcore please re-examine your logic in your code. if not char:FFC("Forcefield") then WILL run if Forcefield does NOT exist. If it is not running the code in the if statement then child ForceField exists. User#18718 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

If the forcefield is nil then

if char:FindFirstChild("ForceField") == nil then

Answer this question