- 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.
- 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 = {
Color3.new(0.13135, 0.99968, 0.023621),
Color3.new(0.000106813, 0.00175479, 0.998215),
Color3.new(0.986252, 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;
})
end
game.ReplicatedStorage.Joined.OnClientEvent:Connect(function()
joinedMessage()
print(player.Name.." has joined the game")
end)
Can anybody help?