#my admin commands are no working

1 messages · Page 1 of 1 (latest)

unborn scroll
#

local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")

local Admins = { "Cookie12bo", "Mrpenguin892"}
local function IsAdmin(Player)
for _, AdminName in ipairs(Admins) do
if string.lower(Player.Name) == string.lower(AdminName) then
return true
end
end
return false
end

local function AddAdmin(PlayerName)
if not table.find(Admins, PlayerName) then
table.insert(Admins, PlayerName)
Announce(PlayerName .. " has been added as an admin!")
else
Announce(PlayerName .. " is already an admin!")
end
end

local function RemoveAdmin(PlayerName)
for i, AdminName in ipairs(Admins) do
if string.lower(AdminName) == string.lower(PlayerName) then
table.remove(Admins, i)
Announce(PlayerName .. " has been removed from admin!")
return
end
end
Announce(PlayerName .. " is not an admin!")
end

local function Announce(Message)
for _, Player in ipairs(Players:GetPlayers()) do
Player:SendMessage("ANNOUNCEMENT: " .. Message)
end

StarterGui:SetCore("SendNotification", {
    Title = "ANNOUNCEMENT";
    Text = Message;
    Duration = 5;
})

end

Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Msg)
local Args = string.split(Msg, " ")
local Command = string.lower(Args[1])

    if IsAdmin(Player) then
        if Command == ":addadmin" and Args[2] then
            AddAdmin(Args[2])
        elseif Command == ":removeadmin" and Args[2] then
            RemoveAdmin(Args[2])
        elseif Command == ":announce" and Args[2] then
            local Message = table.concat(Args, " ", 2)
            Announce(Message)
        end
    end
end)

end)

valid cargoBOT
#

This post has been reserved for your question.

Hey @unborn scroll! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

valid cargoBOT
unborn scroll
#

what is the difrence

white yew
#

well, they are two different coding languages. this server is for helping people with Java. you'd get more luck in a Lua discord server or since this appears to be for Roblox, a Roblox server.

unborn scroll
#

thx