Well, the problem is that you didn't set up your Function correctly. (Click on the highlighted word for how a Function is set up.) Other problems include that you used the ColorSequence function, when for this you have to use the BrickColor function; you also didn't give a valid color (you gave a function), and you didn't set anything up for the code to fire when the player joined: for this, you have to use the PlayerAdded event, which will fire when a player connects to the server.
An example of the PlayerAdded is the following; however, to note, the PlayerAdded event is only usable for the Players service: you can't use it for anything else, it's for the Players service only; now, onto the example:
1 | function onPlayerJoin(plyr) |
3 | print (plyr.Name, 'joined the server! :D' ) |
8 | game.Players.PlayerAdded:connect(onPlayerAdded) |
Now, onto Colors, or BrickColors: for brick colors, to edit them via a script, you have to use the BrickColor, as stated earlier: doing something like just giving it a string w/o the function will not work, and will break your script. To note, however, do NOT confuse BrickColor w/ Color3, as they're entirely different functions who work for entirely different usages, being one works for bricks, while the other works for GUIs.
To note, however, you could combine the two functions together to make a powerful ally! But you need to be careful as to how you code them, as they'll break your script otherwise.
Alright, here's an example of how to use the BrickColor function:
1 | local PartBrickColor = BrickColor.new( 'Really red' ) |
3 | game.Workspace.BasePlate.BrickColor = PartBrickColor |
Now, onto what I heard earlier about combining the two functions! If you have a specific color you want for the brick, but it's the color of the GUI you want it to be, and it isn't on the palette, you can combine the BrickColor function & the Color3 function, and vise-versa!
Here's an example of this:
3 | local GUIBackgroundColor = GUI.BackgroundColor 3 |
5 | game.Workspace.BasePlate.BrickColor = BrickColor.new(GUIBackgroundColor) |
For the vise-versa of this, you can read about it here.
Aaaaand that's all there is to it. :P
I didn't rewrite your code, b/c that's your job to do: we can't give you scripts; we can only help you w/ your scripting problems. (Although, under some circumstances, this is done anyways. XP)
Stuff touched on, but didn't go into great detail about
Function - A most powerful tool in the scripting world: a function, if contained w/ code, can be fired multiple times, and prevents rewriting the same code over-and-over again; to call upon it, you just call upon its name.
ColorSequence - Can't quite explain this, as I've never used this before. e-e Check out the WIKI docu for an explanation about this function.
The Output - A powerful function, and a grand ally in the scripting world! It's essentially your best friend whenever you code. :P What it does is it returns feedback that was given to it, such as strings, numbers, errors, warnings, etc.
I stated previously that "you ALWAYS have to uppercase the first letter in the name, otherwise it wont read it as a valid colour, unless you give it a number." (This is for when you give the BrickColor a string for the argument.) It's pretty self explanatory, but to recap, you require, for when you want to give a string for the colour to the BrickColor function, to uppercase the first letter in the name, otherwise it'll read it as a invalid argument, and return Nil. (If the WIKI docu was confusing, click here for a more explanatory explaination.)
The PlayerAdded Event - As stated before, it will fire for when the player connects to the server, and will return it (if you're using a function, like to add leaderstats to the player); however, this event can NOT be used anywhere else other than the Players service: this event is for it only.
B/c it looks like you're starting out, I recommend you check out this WIKI docu for a tutorial on how to write code/ script. :) (Credit to duckwit for pointing this out! :D)
Hope this helped you in any way! :D