Im honestly lost it just doesnt work and i dont know which one to use
= works like this:
1 | local Name = "Test" -- = is used to set a variable |
== works like this:
1 | local Name = "Test" |
2 |
3 | if script.Parent.Name = = Name then -- == is used to check if two variables match each other |
4 | print ( 'match' ) |
5 | end |
you use = when declaring variables or modifying them and you use == in conditional statements
You use == in if statements to check if something is worth exactly that but when you use = then you are setting the value. For example.
1 | Local debounce = false -- Here you are declaring a variable by using = |
2 |
3 | function hello() |
4 |
5 | if debounce = = false then -- here we are looking if debounce is equal to false or not. |
6 |
7 | end |
8 | end |
The "==" sign is used for comparisons
The "=" sign is used to define variables and all that jazz.
1 | a = fat |
would work, but
1 | a = = fat |
would not work unless you're comparing in a print or in an until.
but, you can do
1 | a = fat --lets just say fat was defined before, now "a" points to the variable "fat" |
2 |
3 | if a = = fat then --since a points to "fat", it will almost always return true, unless you do something dumb with the a/fat variables |
4 | print (a = = fat) --since a == fat is correct, the statement a == fat will return true. |
5 | end |
Marked as Duplicate by xAtom_ik, User#20388, DeveloperSolo, and cabbler
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?