I’m making a custom admin system and I can’t seem to figure out how to make the chat command non-case sensitive. For now, it will operate commands perfectly on other users when their exact username is inputted into the command (for example “:kick maddiesswrld”), but I want it to work even if the capitalization isn’t exact (for example :kick MaDdIeSsWrLd"). How could I do this?
you can use string.lower() to lower the string in your case the message
Well right, but if I’m correct that would only work if the targeted user has an all lowercase username. The goal is to have it find the player no matter what capitalization is used in the command or within their username.
yes, thats why you use string.lower so you can find their name in lowercase
1 Like
this is a example of what Poptartz mean:
local name = "Poptartz"
for _, Player in ipairs(Players:GetPlayers()) do
if string.lower(Player.Name) == string.lower(name) then
print("Right")
end
end
1 Like
This is a perfect example of what I’m talking about lol
1 Like
so in your case you would want to kick
local name = "Poptartz"
for _, Player in ipairs(Players:GetPlayers()) do
if string.lower(Player.Name) == string.lower(name) then
Player:Kick("You Have Been Kicked")
print("Kicked")
end
end
2 Likes
Thank you this is also helping me a lot.
1 Like
Ah okay, I thought you meant just changing the command capitalization at first lol but this makes sense. Thank you for the help!
1 Like