So I made my admin commands system with this tutorial and I want to add a announcement command. It looks like the typicall “M” command in HD Admin´.
This is my code so far:
local Admins = {
"TheBuds_DevGroup"; -- Username example
"ChadErgus1";
"EOASTUDIO";
"beni_betimele";
"foxoxmox";
"Andrew49622";
"crazysilllybaby123";
"BPhant0m2000";
"LordxFarouk";
}
local Prefix = "$"
local Players = game:GetService("Players")
local Commands = {}
Commands.print = function(Sender,Arguments)
-- Command Here
end
local function IsAdmin(Player)
for _,Admin in pairs (Admins) do
print(Admin,Player)
if type(Admin) == "string" and string.lower(Admin) == string.lower(Player.Name) then
return true
elseif type(Admin) == "number" and Admin == Player.UserId then
return true
--[[elseif type(Admin) == "table" then
local Rank = Player:GetRankInGroup(Admin.GroupId)
if Rank >= (Admin.RankId or 1) then
return true
end]]
end
end
return false
end
local function ParseMessage(Player,Message)
Message = string.lower(Message)
local PrefixMatch = string.match(Message,"^"..Prefix)
if PrefixMatch then
Message = string.gsub(Message,PrefixMatch,"",1)
local Arguments = {}
for Argument in string.gmatch(Message,"[^%s]+") do
table.insert(Arguments,Argument)
end
local CommandName = Arguments[1]
table.remove(Arguments,1)
local CommandFunc = Commands[CommandName]
if CommandFunc ~= nil then
CommandFunc(Player,Arguments)
end
end
end
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message,Recipient)
if not Recipient and IsAdmin(Player) then
ParseMessage(Player,Message)
end
end)
end)
Thanks if you can help!