Getting the player from BAE plugin

IDK how to get the player e.g. :clear <User> then the user will be clear

--[[
	
	 ____                                   
	/\  _`\                    __           
	\ \ \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 = 'clear'
	local pluginPrefix = Prefix
	local pluginLevel = 0
	local pluginUsage = "<User(s)>" -- leave blank if the command has no arguments
	local pluginDescription = "Clear the player"
	
	-- Example Plugin Function --
	local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
		-- Get the player
		
		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

What exactly are you trying to do?

Getting the player the I mention e.g. :clear CurrencyType that only I want to do
image

game:GetService(“Players”):WaitForChild(fullusername)

But I think string is not defind I think this is a args

Okay but how do I know if the player typed

Add this:

      if Args[3] then
            local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
			local combinedVictims = ''
			for a,b in pairs(Victims) do
				if combinedVictims == '' then
					combinedVictims = b.Name
				else
					combinedVictims = combinedVictims..', '..b.Name
				end
			end
			for a,b in next,Victims do
                        --b is the players instance.
        end

Where do I need to put my code?

In the pluginFunction function.

Is this in plugin function? Right?

Like I just said, yes. It is in the pluginFunction.

You will obviously still have to code the reset part of your code.
(Shameless plug here, but my overhead system PurpleTag | Overhead Tag provides an event for that)

So I can get the player name right?

      if Args[3] then
            local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
			local combinedVictims = ''
			for a,b in pairs(Victims) do
				if combinedVictims == '' then
					combinedVictims = b.Name
				else
					combinedVictims = combinedVictims..', '..b.Name
				end
			end
			for a,b in next,Victims do
                        print(b.Name)
        end
end

add another end and it should be all good, yeah.

This is right now.

--[[
	
	 ____                                   
	/\  _`\                    __           
	\ \ \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 = 'clear'
	local pluginPrefix = Prefix
	local pluginLevel = 0
	local pluginUsage = "<User(s)>" -- leave blank if the command has no arguments
	local pluginDescription = "Clear the player"
	
	-- Example Plugin Function --
	local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
		if Args[3] then
      local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
      local combinedVictims = ''

      for a,b in pairs(Victims) do
        if combinedVictims == '' then
          combinedVictims = b.Name
				else
					combinedVictims = combinedVictims..', '..b.Name
        end
      end
        for a,b in next,Victims do
      print(b.Name)
      end
    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

Well, test it out, see if it’s erroring or not.

BTW if I do this :clear Curren it will work right?
And also :clear Curren, Oji

Yes, but don’t put a space between Curren and Oji, it would be run like :clear curren,oji.

1 Like

Okay thanks, BTW if I want a new plugin I just need to copy the module script right?

Yep, I would suggest naming them for organizational purposes though.

Okay. Last question why it’s not Args[1] or Args[2]?