Hello everyone!

I’m working on something and I’m having a bit of trouble with SQL. Basically, I want the player to be able to change the color of a chatbox to their liking. I have this working, but I need it to stay as the user set it when they leave and rejoin the server. To do this, I’m using:

if (!sql.TableExists("chatbox_playersettings")) then
	sql.Query("CREATE TABLE chatbox_playersettings(UniqueID, MainColor) VALUES (UniqueID = '".. LocalPlayer():UniqueID() .. "', MainColor = '" .. Options.ChatboxMainColor:GetColor() .. "'")

When I change the color of it (using a DColorMixer in game) I get the error “attempt to concatenate a table value” on the line that creates the table. Is there a way I can store a color in a table? Thanks

You could concatenate the rgb elements into a string and remake it when parsing

[editline]18th March 2015[/editline]


Also you are mixing server and client side functions.

LocalPlayer() does not exist on the server.

Create the table if it does not exist but do not add anything into it.

Next when a player connects ( PlayerInitialSpawn also is fine ) query the database to see if they are in the database, if they are not THEN you will add them.

You are trying to do it all at once, which in your case wont work.

He’s saving it on the client.

Completely forgot that it even existed on the client :<