Line 3, where I get the board ID, stops the script from working properly. It allows me to print throughout the script, but the functions itself won't work properly. No errors occur, and nothing happens for these custom admin commands.
local Players = game:GetService("Players")
local API = require(game:GetService("ServerScriptService"):WaitForChild("TrelloAPI"))
local BoardID = API:GetBoardID("622907324")
local Prefix = "%."
local Admins = {
"AbstractBody"
}
local Commands = {"Kill","Stat","Kick"}
local function IsAdmin(Player)
for _,Admin in pairs(Admins) do
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
end
end
return false
end
local function ParseMessage(Player,Message)
local PrefixMatch = string.match(Message,"^"..Prefix)
if PrefixMatch then
local Message = string.gsub(Message,PrefixMatch,"",1)
local Arguments = {}
for Argument in string.gmatch(Message,"[^%s]+") do
table.insert(Arguments,Argument)
end
for _,Command in pairs(Commands) do
if string.lower(Arguments[1]) == string.lower(Command) then
local PlayerInCommand = string.lower(Arguments[2])
local PlayerCommand = string.lower(Arguments[1])
-- Kill --
if PlayerCommand == string.lower("Kill") then
for _,v in pairs(Players:GetChildren()) do
if string.match(string.lower(v.Name),"^"..PlayerInCommand) then
local Hum = v.Character:WaitForChild("Humanoid")
Hum:TakeDamage(Hum.MaxHealth)
end
end
end
--
-- Change Stat --
if PlayerCommand == string.lower("Stat") then
for _,v in pairs(Players:GetChildren()) do
if string.match(string.lower(v.Name),"^"..PlayerInCommand) then
if type[Arguments[4]] == "number" then
local NewStat = Arguments[4]
local StatChated = Arguments[3]
local Stat = string.lower(v:WaitForChild("leaderstats"):WaitForChild(string.lower(Arguments[3])))
if Stat then
Stat.Value = NewStat
end
end
end
end
--
-- Kick Player --
if PlayerInCommand == string.lower("Kick") then
for _,v in pairs(Players:GetChildren()) do
if string.match(string.lower(v.Name),"^"..PlayerInCommand) then
PlayerInCommand:Kick()
end
end
end
--
end
end
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message,Recipient)
if not Recipient and IsAdmin(Player) then
ParseMessage(Player,Message)
end
end)
end)

1 comment
I noticed that it only works if the :GetBoardID is below the ParseMessage(Player,Message) at line 84