BAE 2.0 custom command not working

Hello! I am trying to make a custom command with the BAE 2.0 loader, but it isn’t working for some reason.
There is no output in studio, and nothing is happening. The script is a module script in ServerScriptService.

--[[
	
	 ____                                   
	/\  _`\                    __           
	\ \ \L\ \     __      ____/\_\    ___   
	 \ \  _ <'  /'__`\   /',__\/\ \  /'___\ 
	  \ \ \L\ \/\ \L\.\_/\__, `\ \ \/\ \__/ 
	   \ \____/\ \__/.\_\/\____/\ \_\ \____\
	    \/___/  \/__/\/_/\/___/  \/_/\/____/
	                                        
	            
	Admin Essentials v2
	Plugin Documentation
	*coming soon^tm
	
	If you have any questions regarding Plugins, contact TheFurryFish.
	
--]]

local Plugin = function(...)
	local Data = {...}
	
	-- Included Functions and Info --
	local remoteEvent = Data[1][1]
	local remoteFunction = Data[1][2]
	local returnPermissions = Data[1][3]
	local Commands = Data[1][4]
	local Prefix = Data[1][5]
	local actionPrefix = Data[1][6]
	local returnPlayers = Data[1][7]
	local cleanData = Data[1][8] -- cleanData(Sender,Receiver,Data)
	-- Practical example, for a gui specifically for a player, from another player
	-- cleanData(Sender,Receiver,"hi") -- You need receiver because it's being sent to everyone
	-- Or for a broadcast (something everyone sees, from one person, to nobody specific)
	-- cleanData(Sender,nil,"hi") -- Receiver is nil because it is a broadcast
	
	-- Plugin Configuration --
	local pluginName = 'host'
	local pluginPrefix = Prefix
	local pluginLevel = 3
	local pluginUsage = "<User(s)>" -- leave blank if the command has no arguments
	local pluginDescription = "Host server."
	
	-- Example Plugin Function --
	local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
		local Player = Args[1]
		if Args[1]
		then
			game.StarterGui.HostingGUI.HostLabel.Text = "Host: "..Player.Name
			game.StarterGui.HostingGUI.AnouncementLabel.Visible = true
			wait(15)
			game.StarterGui.HostingGUI.AnouncementLabel.Visible = false
		end
	end
	
	-- Return Everything to the MainModule --
	local descToReturn
	if pluginUsage ~= "" then
		descToReturn = pluginPrefix..pluginName..' '..pluginUsage..'\n'..pluginDescription
	else
		descToReturn = pluginPrefix..pluginName..'\n'..pluginDescription
	end
	
	return pluginName,pluginFunction,pluginLevel,pluginPrefix,{pluginName,pluginUsage,pluginDescription}
end

return Plugin

And this is the explorer:
image
image
Thanks!

1 Like

Well, I think you may have to use the Basic Admin Main Module.
I tried using the MainModule script to make an Afk Command and It worked.

1 Like

I will try that, thanks! 30 chars

Did you try ungroupping it?.. (30 charss)

1 Like

Just did, no difference though. Does anyone know how I can insert the main module? It’s in my inventory but doesn’t show up in toolbox.

Well, I used a Google chrome extension to download it.
BTroblox

1 Like

TheFurryFish made a very sophisticated very easy to understand system for adding plugins.

When inserting Basic Admin Essentials 2.0 into your game, the main script (“Basic Admin Essentials 2.0”) should be inserted into the ServerScriptService service.

Under this there is a Folder instance called “Plugins”. Inserting the script you wrote into that Folder under it’s own designated Module should at least load your plugin.

Be sure to keep it nice and organized by giving it a name respective to it’s functionality.

Alternatively the “local Player = Args[1]” references to the sending player.

To properly supply the Plugin Handler with “victims” you should do something like this:

local function pluginFunction(Args)
	local Player = Args[1]
	if Args[3] then
		local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
		
		for a, b in next, Victims do
			print(b.Name, b.UserId)
		end
	end
end

Unless in your instance you’re only trying to use the sending player. :slight_smile:

Edit: putting your code into a Module and inserting it into the Plugins folder gave me a working command. Changes I made to the script shouldn’t be significant to the outcome but I changed

local Player = Args[1]
if Args[1]
then

to

local Player = Args[1]
if Args[1] then
1 Like

Oh oh oh! I overlooked something super out of the ordinary in your script too.

You’re trying to change the GUI inside of StarterGui.
This would only take effect if the GUI has ResetOnSpawn enabled and the user resets their character!

To give players a real-time update you should FireAllClients using a RemoteEvent and make the changes on the Client-side instead of the Server.

1 Like

Mostly I use he main module script so I can add/remove commands.
But for him he will need to edit some stuff.

1 Like