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
7 years ago
1if char:FindFirstChild("ForceField") then

how do i make this negative? for example:

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

2 answers

Log in to vote
3
Answered by 7 years ago

Just type "not" after if

1if not char:FindFirstChild("ForceField") then
0
^^ oSyM8V3N 429 — 7y
0
tried already and it doesn't work because findfirstchild returns nil Elixcore 1337 — 7y
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 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

If the forcefield is nil then

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

Answer this question