A chatted event is an event that will allow you to fire a function when a player
chats a message.
Chatted events may sometimes be referred as "commands".
function onChattedEvent(player) player.Chatted:connect(function(msg) if msg == "Hello!" then print("Somebody said hi.") end end end game.Players.PlayerAdded:connect(onChattedEvent)
To begin explaining, the "player" within the backets for "onChattedEvent" is
called a peremeter, and it just means the "local player" which is the person
who joined the server.
The other peremeter, "msg", means "message", and it refers to what a player had
The "if" function will check if the player's message is equalled to the command,
which I just made the command "Hello!". If whatever the player messaged is equalled
to the command, then the script will print "Someone said hi." in the output.
The "game.Players.PlayerAdded:connect(onChattedEvent)" just simply starts the
function I created, called "onChattedEvent", when a play joins the server.
(The last statement is very important, but there are other ways you could
code it in LUA.)
Hopefully you can find this easy to understand. You can comment some questions
if you want; I'll try to reply.