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 be able to compare strings?

For example

local number = 30

if number >= 30 then
print("Not")
end

^ That's how I would compare numbers, but how would I compare strings?

Solved

I can compare strings by

local string1 = "hello"
if string1 == "hello" then
print("Hello World!")
end

1 answer

✓ Accepted answer

Just as you can compare two numbers to see if they're equal, you can compare two strings to see if they're the same.

print("string1" == "string2") --Will be false
print("string" == "string") --Will be true

There's a bunch of other, more advanced, ways of comparing strings using functions from the string library.

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