This modified version is not correct and won’t work as intended. It might look like it’s checking whether instance.Name is either “A” or “B”, but it’s actually not. The reason is that "B" by itself is treated as a truthy value in most programming languages, so the if statement would always be true regardless of the value of instance.Name.
To achieve the same logic correctly, you need to keep the original format:
if instance.Name == "A" or instance.Name == "B" then
This format ensures that both comparisons are done correctly and the or operator combines their results appropriately.
As others have said, the first part of the statement is checking if instance.Name is equal to A, while the second part is just checking if B, which will always just return true. If you need to check multiple names you could simply check if its name is within a table like this: