How to make an if statment work the opposite way

i want to make it so if the value doesnt match plr.Name the code runs but using ~= doesnt work and using == works but the opposite way

if value == plr.Name then --make this work the opposite way
table.insert(InRound, plr.Name)
if i%2 == 0 then
plr.Team = game.Teams.RedTeam
else
plr.Team = game.Teams.BlueTeam
end
end

1 Like

idk why it wont let me put tabs before the code

do you mean to run the code if value isn’t equal to plr.Name ??
if though than ~= should work, try printing value and plr.Name before the if statements to make sure that they aren’t the same

idk why ~= doesnt work heres a bigger part
image

that may be because value is equal to plr.Name try printing both of them before the if statements to make sure that they aren’t equal

value is a table the script searches if there is plr.Name in the table

If you want to see if plr.name is in table use table.find(table, item)

Like so:

if not table.find(value, plr.Name) then
--code
end

Right now you’re checking if value is equal to plr.Name

2 Likes