unexpected symbol near '=' (PLEASE HELP)

when coding for a new game mode (was following a tutorial on the basics, made my own stuff with that knowledge) and i was working on GUI. then this happened

[ERROR] gamemodes/spooky ghosts/gamemode/cl_init.lua:73: unexpected symbol near ‘=’

  1. unknown - gamemodes/spooky ghosts/gamemode/cl_init.lua:0

Couldn’t Load Init Script: ‘spooky ghosts/gamemode/cl_init.lua’

I thought the second error was a effect of the first so i tried to fix the first and disasters ensured
all i know is that the code doesn’t work and i need massive help. I’m new to lua coding and basically coding in general. please help!
(what i was trying to do was have the GUI change based on what team you where on)

Use [ code] tags. Also whitespace, you need to put l lots of whitespace in that code.

if plyT == 1 then TColorRed = 255 and TColorGreen = 0 and TColorBlue = 0

There is no need for the ands there, but with whitespace it should also look like.

if plyT == 1 then
    TColorRed = 255
    TColorGreen = 0
    TColorBlue = 0


actually, there’s a lot more wrong with that code than just line 73.

It almost seems as though you’re trying to use a ternary without using a ternary… It would also help if you tabbed your code.


Or, if you’re trying to set all 3 vars in a line. But this is done using commas, not "and"s.

// Define them...
local TColorRed, TColorGreen, TColorBlue = 0, 0, 0;
if ( plyT == 1 ) then
	TColorRed, TColorGreen, TColorBlue = 255, 0, 0; -- Or just set 1 since we defined all as 0.

He could define them on new lines; but you’re right, the ands do not serve a purpose because he’s trying to define multiple vars on one line which is done using commas.

He’s trying to set the variables, not test them. There are also 2 "then"s in that, and 1 = for red.

Thanks for helping me fix this disaster. im brand new and didnt know where to start.