Getting a string from a group description

Hey there, so currently im creating a sort of team system for my game which gets a group goes to their description and then gets their colorcode from their description, my issue is i’m not quite sure on how string patterns work and instead of returning color, plum for an example it returns color color
image

Here is what I tried, the description is formatted like so:

Description text

Color: Plum -- this is what im trying to get as a value

Heres the code I tried:

local newString = group.Description.match("Color:", ".+")
			
if group.Description.match("Color:", ".+") then
	local SplitMessage = string.split(newString, ":")
	local Value1, Value2 = SplitMessage[1], SplitMessage[2]
	print(Value1, Value2)
else
	local Team = Instance.new("Team")
	Team.Name = group.Name
	Team.TeamColor = BrickColor.random()
	Team.Parent = game:GetService("Teams")
end

Oh thats odd I must’ve accidently moved the tags.

I believe you can use this pattern:

"Color: (%a+)"
local color = group.Description:match("Color: (%a+)")
-- returns nil if it can't find anything with "color: <COLOR>"
-- example: will return "Black" if it finds "Color: Black"
1 Like