What exactly is a string?

What exactly is a string?

I know that it holds some value but what is it used for?

1 Like

A string is a value meant for text. Same* thing for int, int is a value for numbers. Roblox also has special functions regarding strings, like this;

local Message = "Hey! This is a string.";

if Message:find("Hey!") then
   print("Hello!");
end;

What the code above does is check if the message contains “Hey!”, and if it does it prints out “Hello!”.

Learn more about strings here.

1 Like

Strings are basically characters that are inside the quotes

They can be used to print,assign a variable,fire a function using it as a paramater (such as :FindFirstChild() ) and ect

Printing using string:

print("Pretty much self-explanatory")

Assigning a variable using string and then printing it

local aVariable = "Hello!" --this will print hello
print(aVariable)
1 Like

And I’m sorry if I’m asking a lot of questions, but what types of strings are there? (If there are any)

There is only 1 type of string. Which is literally any characters you can think of (including numbers)

String the word is just referring to characters in a line.

There is only one type.

1 Like

You can also have multiple lines in a string using [[
here is an example:

print([[Hello world!
This is a second line
This is a third line
Goodbye!]])

Or you can use \n which this

print("Hello world!\nThis is a second line\nThis is a third line\nGoodbye!")

Is the same as the one above

Tip: If one of the replies here is the solution to your question then you can mark it as a solution.

“Yeet” ← String
‘Yeet’ <— String
[[Yeet]] <— String
“true” ← String
“false” <— String
“123” <— String

true ← Boolean
false <— Boolean
123 <— Int

THIS WAS A REPLY TO MAIN THREAD NOT YOU @zaydoudou SORRY

1 Like