As long as I know, using :lower() can make us use both caps and lower
I tried making a command like if message == ";kick " .. playername:lower() then but when I typed that in roblox's chat as caps lock it doesn't fires the if statement
How can I fix this?
You should convert the command to lowercase first, and compare if the first 6 letters is ";kick ". If yes, then you can get the player by doing string.sub(lowercaseCommand, string.len(kickCommand) + 1, string.len(lowercaseCommand)
. Here's a concept:
local lowercaseCommand = string.lower(message) -- replace message of your chatted function parameter local kickCommand = ";kick " -- Remember to put a space so you can easily separate command and player and make this FULLY LOWERCASE if string.sub(lowercaseCommand, 1, string.len(kickCommand)) == kickCommand then local playerInCommand = string.sub(message, string.len(kickCommand) + 1, string.len(lowercaseCommand)) -- Get the player, for example ";kick Xapelize" from the length of kickCommand plus 1 is 7, so starting from X to the last length of message (since it returns the correct capitalization of player) is e, so it returns Xapelize local player = game:GetService("Players"):FindFirstChild(playerInCommand) -- Find the player, FindFirstChild detect if something exists, if not, it returns nil instead of error if player then -- If player exists player:Kick("You have been kicked") -- Kick the player end end
This is a concept, you need to code the rest yourself though