Currently, I have been trying to make an admin commands system, it works fine but the problem is if I write the players name in lowercase, it never works, is there any way for me to make it so even when the players name is written in lowercase it works?
local headadmins = {''}
local admins = {''}
local lowadmins = {''}
local prefix = "!"
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(eeelol, recipent)
local message = string.lower(eeelol)
local splitmessage = message:split(" ")
local command = splitmessage[1]
local maincommand = command:split(prefix)
local commandname = maincommand[2]
local playername = eeelol:split(" ")[2]
--Kick Start
if commandname == "kick" then
print('they said kick')
if splitmessage[2] then
for i, v in pairs(admins) do
wait()
if plr.Name == v then
print('plr is admin')
if game.Players:WaitForChild(playername) then
local reasonofkick = eeelol:split(playername)
print("player exists")
game.Players:FindFirstChild(playername):Kick(reasonofkick[2])
print('kicked')
end
end
end
end
end
--Kick End
--Teleport Start
if commandname == "teleport" then
if splitmessage[2] then
if splitmessage[3] then
for i, v in pairs(lowadmins) do
wait()
if plr.Name == v then
if game.Players:WaitForChild(playername) then
local tpcommandidkfirst = eeelol:split(" ")
game.Workspace:WaitForChild(tpcommandidkfirst[2]):FindFirstChild("HumanoidRootPart").Position = game.Workspace:WaitForChild(tpcommandidkfirst[3]):FindFirstChild("HumanoidRootPart").Position
end
end
end
end
end
end
--Teleport End
end)
end)

2 comments
thanks it helped
Use :GetPlayers instead of :GetChildren() because it checks if the child is a PlayerObject