Here is my code
print("Clear Server Loaded")
local Commands = {}
local function FindName(Name)
for i, Player in pairs(game.Players:GetPlayers()) do
if string.lower(Player.Name) == Name then
return Player
end
end
return nil
end
Commands.clr = function(Sender, Arguments)
print("Running 'clr' command")
print(Arguments[1],Arguments[2])
for i, PlayerName in pairs (Arguments) do
print(PlayerName)
end
local Authorizer = Arguments[1]
local KPlayer = Arguments[1]
if KPlayer then
print("KOS player exists")
local KosPlayer = FindName(KPlayer)
if KosPlayer then
print("KOS players character found")
local Character = KosPlayer.Character:WaitForChild("Head")
local KElements = Character.RankUI.Tag
local Tag = KElements.TagTitle
local TagShadow = KElements.TagShadow
local FillText = "Authorzied"
print("Variables set")
Tag.Text = FillText
--Tag.TextColor3 = (21, 255, 36)
TagShadow.Text = FillText
print("Text is set")
Tag.TextTransparency = 0
TagShadow.TextTransparency = 0
print("Text is visible")
end
end
end
Commands.kos = function(Sender)
print(Sender.Name)
print("This will run when you say Kos")
end
game.Players.PlayerAdded:Connect(function(Player)
if Player.Team.TeamColor == BrickColor.new("Black") then
Player.Chatted:Connect(function(Message,Recipient)
Message = string.lower(Message)
local SplitString = Message:split(" ")
local Command = SplitString[1]
if Commands[Command] then
local Arguments = {}
for i = 2, #SplitString, 1 do
table.insert(Arguments,SplitString[i])
end
Commands[Command](Player,Arguments)
end
end)
end
end)
Right now it works only if you type the full player's name but I am interested in having a best match so they could type clr Nord instead of Clr NordicAnarchy.
