Colors/colours table won't work

  1. What do you want to achieve? Keep it simple and clear!

I have a table of colors/colours and I want math.random to pick a random color from the table.

  1. What is the issue? Include screenshots / videos if possible!

The issue is that I keep getting this error:

Chat.ClientChatModules.MessageCreatorModules.Util:99: invalid argument #3 (Color3 expected, got number)

Local script inside StarterGui - Code

local StarterGui = game:GetService("StarterGui")
local player = game.Players.LocalPlayer

local colors = {, 0.99968, 0.023621),, 0.00175479, 0.998215),, 0.00712596, 0.0274357)

local color = math.random(1, #colors)

local function joinedMessage()
	repeat wait() until player.Character
	StarterGui:SetCore("ChatMakeSystemMessage", {
		Text = player.Name.." has joined the game!";
		Color = color;
		Font = Enum.Font.ArialBold;
		Size = 20;

	print(player.Name.." has joined the game")

Can anybody help?

This is the wrong bit, this gets a random number between 1 and the number of colours
What you want instead is

local color = colors[math.random(1, #colors)]

I don’t know if you want a different colour each time, if so then you’d need to move this into the joinedMessage() function, at the moment this random colour is just picked once and will then be used for every player who joins.

Hope that helps,