Player Off Chat

–[[ Yes I’m dumb ]]–
How do you get a player variable off someone typing there name/part of there name. kind of like if someone types in chat !<COMMAND> <NAME> how would i get that player variable?


wtf is a player variable?

Just use an OnPlayerChat or a PlayerSay hook. The player variable is the first one in both.

If you want to find a player based on part of their name, you will have to loop over all the players and pick whoever’s nick matches.

Are you asking how you would find the player based on the <name> input of the chat command?

I believe what he means is typing !command jas (For example) and getting all players with “jas” in their name.
In that case, use

string.find (And probably

string.lower), while looping through all players

And for filtering the arguments of the command

string.Explode (there are more complex ways of “getting” the arguments)