How do you know if player chatted a font or color?

(I’m making this topic because I was curious on how to do this)

So I know how to do the /name string but I don’t know how it works with colors and fonts, is there some kind of loop that detects that player chatted a font or a color and it changed the player’s font/color??

Example:

afbeelding

afbeelding

All I want to know is how the script detects if player has chatted a color/font.

This uses the Player.Chatted event and gets the strings present in the message.

example

Player.Chatted:Connect(function(message) -- event to detect when the player chatted
    local commands = { -- table to hold the commands
       ['command'] = function(...) -- function to be called
            print(...) -- prints the arguments that were sent
        end
    }

    if message:sub(1, 1) == "/" then -- get the first character in the message
        local cmd = message:sub(2, #message):split(" ") -- split the message up by spaces
        
        if commands[cmd[1]] then -- check if the command exists
            local c = commands[cmd[1]] -- get the command function
            cmd[1] = nil -- make the first word nil (the first word is the command name which isn't needed anymore)
            c(table.unpack(cmd)) -- send the arguments that were sent
        end
    end
end)
1 Like

Wait so for color you have to write all brick colors? :joy:

No, you can do:

function(colorName)
   local brickColor = BrickColor.new(colorName)
   -- do stuff
end

If the provided color that the user said isn’t valid then it defaults to Medium Stone Grey

1 Like

Ooohh, yeah now i get it, I can just make a in-script string value, each time it messages it assigns the color and checks if it’s an actual brick color, that’s what i would do, i don’t know about y’all.