Use if ... == ... then ... end for check arguments.
You can see of Conditional Statements here in wiki: Conditional Statements in Lua
Conditional statements allow your script to perform specific actions when specific conditions are met.
Here is a example image: Image
if code script:
if 2 + 3 == 5 then
print("two plus three is five")
end
There is also the "else"
else image example
else code example:
if 10 > 100 then
print("10 is greater than 100")
else
print("10 is less than 100")
end
There are also things with "elseif" here's an example:
elseif image example
elseif code example:
if 10 > 100 then
print("10 is greater than 100")
elseif 10 > 50 then
print("10 is greater than 50")
elseif 10 < 100 then
print("10 is less than 100")
end
All of the above is on the wiki
It is advisable to read the wiki, because there are many other examples.
How to detect color?
local brick = game.Workspace.Part
if brick.BrickColor == BrickColor.new("Alder") then
print("Hello")
end
How to set color?
local brick = game.Workspace.Part
brick.BrickColor = BrickColor.new("Alder")
you can see of BrickColor Code's in wiki:
BrickColor Code's - Wiki
You can see of BrickColor in wiki:
BrickColor - Wiki
Hope it helped :)
2 comments
() aren't compulsory.
print "Hello World!"works just fine.edited now