This below is a simple command handler I made. But the command runner does not work. Does anybody please know how to fix this?
local Module = {}
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
Module.Commands = {
["1"] = {
["Name"] = "CustomPrint";
["Arguments"] = {};
["Function"] = function(Player)
print("Hi")
end
}
}
Module.AdminList = {
1806855379;
}
Module.DataStore = DataStoreService:GetDataStore("AdminCommands")
Module.Prefix = "?"
local RealAdminList
pcall(function()
RealAdminList:GetAsync("AdminList")
end)
if not RealAdminList then
Module.DataStore:SetAsync("AdminList",Module.AdminList)
RealAdminList = Module.AdminList
end
function Module.Parse(Message,Player)
Message = string.lower(Message)
local SplitString = Message:Split(" ")
local PrefixCommand = SplitString[1]
local Command = PrefixCommand:Split(Module.Prefix)
local CommandName = Command[2]
for _,RealCommand in pairs(Module.Commands) do
local RealCommandLower = string.lower(RealCommand.Name)
if CommandName == RealCommandLower then
RealCommand.Function(Player)
break
end
end
end
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message,Recipient)
Module.Parse()
end)
end)

1 comment
You didn't pass the Message.