I do not understand the difference. They both seem the same to me, they both hold data.
What is the difference between a string and a variable?
3 answers
They are a big difference. So, let me teach you about them.
Variables
Variables are things that can be used for later. So, instead of typing this
print('spam')
print('spam')
print('spam')
print('spam')
print('spam')
print('spam')
print('spam')
print('spam')
print('spam')
print('spam')
you could use variables!
local p = print
local s = 'spam'
p(s)
p(s)
p(s)
p(s)
p(s)
p(s)
p(s)
p(s)
p(s)
p(s)
Strings
Strings are basically text that you don't want roblox to run as actual code. For example, this would error
print(game.sometext)
because sometext is not a member of game. So, to tell the program "Hey, I don't want this code to run", we do
print('game.sometext')
Hope this helps!
1 comment
Also, you cannot hold terrain in a string.
First off, Here is a page I think you may find useful
A variable holds data that can be of any kind. A string is a kind of data that holds text. Other kinds of data are Integers(Number) and Boolean(Logic:True/False). So in other words, a variable can be a string but a string cannot be a variable
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
a string value has strings whereas a variable can hold strings, numbers, almost anything...