what is the difference between one "=" and two "=". Do spaces matter in LUA coding? and last question. What does plr:LoadCharacter() mean, what does the two empty brackets do?
What is the difference between "=" and this "==" And does spaces matter?and other multiple question.
5 answers
I know other people have answered most of these questions, but I'll try to give a more descriptive answer. If you use =, you're setting something to a value, like a variable. For example:
testVariable = 1
--This sets the variable (testVariable) to 1.
Use == if you're comparing two values. For example:
if testVariable == 1 then
print("Hello!")
end
Basically, we're seeing if testVariable is 1. If it is, then the output is "Hello!"
Okay another question. Do spaces matter in Lua? Most of the time, no. For example, it doesn't matter if you do this:
testVariable = 1
or this:
testVariable=1
But if you're trying to specify a part or something else:
--Let's say the name of the part is TestPart.
game.Workspace.TestPart.CanCollide = false
--This is valid
game.Workspace.Test Part.CanCollide = false
--This is invalid, because the game thinks the part it's looking for is called "Test Part", but that is non-existent.
Hope this helps, and happy coding!
2 comments
Thanks :D this actually helps!
Happy to help!
Single = is an assignment to a variable (variable on the left, expression on the right)
Double == is the equality comparison operator, (a==b) evaluates to true or false.
You can't have spaces between the characters in ==, it will not be interpreted correctly.
1 comment
good job you deserve upvotes you got
"=" Is used to assign a value to something while "==" is used for comparing.
"==" is for checking something. "=" is for declaring something.
MyVariable = "Hello"
if MyVariable == "Hello" then
print("Your Variable is the same as "Hello".)
end
= means equals == means equals to
1 comment
very descriptive... I see
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
LoadCharacter() is an internal method to load the players character, the empty parenthesis call the method. Methods are basically just functions with the object sent as the argument. Emily explained the rest.