To get the name, you’ll need to get the arguments from the message (if it sounds confusing, it’s alright because it isn’t really).
To do this, you’ll need to use some string manipulation. The function we’ll need to use in specific is string.split(). What this does is simply split the string using the given “separator” (meaning the things in between words). For example, if we did string.split on something like “Hey, my name’s Ben!” with the separator of " " then it’ll return {“Hey,”,“my”, “name’s”, “Ben!”}. If you don’t understand my explanation, make sure to check out the string page shown to you in the link.
Now you know about that function, we’ll need to apply it to your code to get the args (words) of the message. This is pretty simple, and’ll only requires 2 things: your string (the message) and the separator (space, aka " "). We have those 2 things though, so we can get our args through a simple variable such as local args = string.split(msg, " "). Understand?
Now, let’s pretend the message was something like /balloon Benified4Life. Before we get to that though, let’s make sure you understand what the code sees. If you split up that message “/balloon Benified4Life” into a table, it’d look something like {“/balloon”, “Benified4Life”}. Knowing this, there are 2 words in this string and table. Since we know Lua indexs starts on 1, the index of Benified4Life must be 2 as it’s the second in that table.
To retrieve that, you’ll need to get it as if it is a table, since it is. You can do this simply by saying args[2]. Now, if we combine everything, we get args[2] as our player, meaning you can do player = args[2].
Now, the code looks something like this.
if Player.Name == "Pooglies" then
Player.Chatted:Connect(function(msg)
local args = string.split(msg, " ")
if string.lower(msg) == "/balloon" and args[2] then -- MAKE SURE THAT THERE IS ACTUALLY A PLAYER!
local target = args[2]
end
end)
end
end)