So I know with this much of the script, that it would get the full message from the player. How would I get only part of the message that the player says?
Example, in admin commands:
“:re Catherine858”
That command would find the player named “Catherine858” and reset it.
Similar to what @EmbatTheHybrid said you will be using the split method.
With how your doing it with chat It is best to lower all letters in the message.
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
local Args = string.split(msg:lower(), " ")
print(Args[2])
if Args[2] == "World" then
print("Continue")
end
end)
end)
Let’s say I said, “Hello World” it would print “World” as the second argument in the message.
As others have stated, string.split(string, " ") or string:split(" ") work. If you need a tutorial, I made a whole admin commands tutorial and how to cover making them:
The code you may want to learn from:
msg = string.lower(msg)
local splitString = msg:split(" ") -- makes a table like: {";re", "user"}
local plrName = splitString[2]
someAdminCommand(PersonWhoFiredTheCommand, plrName)