Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I make an if statement as vice versa?

Is there anyway to do like a vice versa instead of :

if alive[1] == "Killer" and alive[2] == "Innocent" or alive[1]== "Innocent" and alive[2] ==  "killer" then
end

and then still be able to compare values after

if alive[HELP].folder.Protect.Value == 0 then --whoever is innocent

~Context

local alive = {}
for i,v in pairs(data:GetChildren()) do
if v.Status == "Alive" then
table.insert(alive, {folder = v, team = v.Team.Value})
end
end

if #alive == 2 then


-- HERE -- 
if alive[1].team == "Killer" and alive[2].team "Innocent" then
if alive[whoever is innocent].folder.Guardian.Value == 0 then --whoever is innocent
return (player[1]) -- Killer wins!
else return (player[2])  -- "Innocent wins"
end
elseif alive[1].team == "Guard" and alive[2].team  == "Criminal" then
end

again:

  1. If statement vice versa
  2. compare value despite order of variables

This is to keep games from lasting forever because neither player can kill each other. And different types of people so it'll be a long list. Looking for an efficient way to code it.

1 answer

✓ Accepted answer

Currently there is no way to do a "vice versa" if statement.

You could replicate one using for _,v in pairs(), however, I will leave that for you to figure out.

1 comment

0

What about interchangeable variables afterwards so that I won't have to have 2 lines of the same thing but in reverse order?

This discussion is preserved as it was. New answers, comments, and votes are closed.