BA Essentials 2.0 View/Unview Command

Hey Community, i wanted to ask how can i make an working View and Unview Command for Basic Admin Essentials 2.0. I asked AI and it only gave me scripts that doesn’t work.
Could anyone help?

You should probably use something more updated in the first place

Under the loader there is a folder called Plugins
Make a new module script and follow the template

--[[
	
	 ____                                   
	/\  _`\                    __           
	\ \ \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 = 'exampleplugin'
	local pluginPrefix = Prefix
	local pluginLevel = 1
	local pluginUsage = "<User(s)>" -- leave blank if the command has no arguments
	local pluginDescription = "Hey, this is a plugin example.\nIt's also multi-line!"
	
	-- Example Plugin Function --
	local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
		local Player = Args[1]
		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
				remoteEvent:FireClient(b,'Notif','Lorem Ipsum','Plugin Example',{'Message','Results',combinedVictims})
			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

I think the pluginFunction is supposed to be the command, and returnPlayers i assume handles parsing inputs like ‘me’ or the first letter of someones name into a table of player objects. Take the first valid player and then set the CameraSubject to them

local camera = game.Workspace.CurrentCamera -- define beforehand

-- in the command
local Victims = returnPlayers(Player, Args[3])
if not Victims or #Victims == 0 then
  return
end

local target = Victims[1]
local character = target.Character
if not character then return end

local humanoid = character:FindFirstChild("Humanoid") :: Humanoid?
if not humanoid then return end

camera.CameraSubject = humanoid

For the unview command set it back to your local player’s humanoid

1 Like