How to see if string values have the same value

So I have a question how I would see if string values have the same value.
I have an idea with a if value comparing 6 string values

if string.Value == string2.Value or string3.Value == string2.Value then

That just keeps going for 6 string values and it looks messy. How would I make it more efficient and cleaner.

You could use a loop and iterate over all the values.

Also this is running in a function and I want it to see if all stringvalues are not the same then run the code that is in elseif .

You wrote the same thing twice, these are the exact same comparisons. I don’t get what your trying to do. Are you seeing if they’re the same string character by character or are you looking for a character in a string?

oh sorry typo there I am trying to see if the string values value is the same or not

local stringValue1 = workspace.Value1
local stringValue2 = workspace.Value2

if stringValue1.Value == stringValue2.Value then
	print("Strings match!")
end

This works for me, you just check each string value’s “Value” property.

It is not clear what you are trying to do.

Are you trying to find if any of the strings match any other string? Or are you trying to make sure they are all identical to each other?

a = dog
b = dog
c = cat
d = dog

what is that supposed to do? a and b match, a and d match, a and c don’t match. Do you care if c and d don’t match?

I think you need to explain it more.

Match each other. not identical to each other.

Would I have to make a or after stringValue2.Value like this?

or stringValue2.Value == stringValue1 then

it depends on if you care whether they all match or just any two, or just two consecutive

if you use or then lets say you have these values dog, cat, owl, chicken, chicken
if you use ‘or’ then the case will be true even though the first ones don’t match

you’re not describing what you intend it to do

do this:

for _, v in pairs(game.Players.Folder:GetChildren()) do
	if v:IsA("StringValue") then
		if v.Value == Something.Value then
			print("test")
		end
	end
end