[OPEN] | Script Issue

  1. What do you want to achieve?
  • I want to create a BAE plugin, it will be a command that would verify all players (check if their account age is >=30 (days) and kick players that <=29 (days).
  1. What is the issue?
  • There are no errors in the script, but it doesn’t work.
  1. What solutions have you tried so far?
  • I didn’t find a solution for this problem.

If you could help me that would be great.

--[[
	
	 ____                                   
	/\  _`\                    __           
	\ \ \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 = 'verify'
	local pluginPrefix = Prefix
	local pluginLevel = 1
	local pluginUsage = "<User(s)>" -- leave blank if the command has no arguments
	local pluginDescription = "Verify a player."
	
	-- Example Plugin Function --
	local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
		local Player = Args[1]
		if Args[3] then
			local combined = ''
			for i,v in pairs(Args) do
				if i > 3 then
					combined = combined..v..' '
				end
			end
			local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
			for a,b in next,Players do
				if b and b.Character:FindFirstChild('Humanoid') then
					game.Players.PlayerAdded:Connect(function(plr)
					if (b.plr).AccountAge < 30 then
						(b.plr):kick("You failed verification, your account must be at least 30 days old.")
					end
				end
			)
		end
	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
2 Likes

do :Kick(“You failed verification, your account must be at least 30 days old.”)

1 Like

On line 61, the Kick method should be capital K.

Around half the defined variables are unused, why?

To be honest, all of the code looks redundant and overcomplicated.
Like first of all, what do you expect to come back from returnPlayers, the whole server or a specified number of players, if so whats the point of listening to the PlayerAdded event as it listens to each and every player.

1 Like

I agree; this code is sort of a bit unneeded and overcomplicated.

We could just define the player, find it’s account age and if player.AccountAge > 30 then print(“Good job.”)

else
player.Kick(“Sorry; come back when your account is 1 month old.”).

Basically something like that and it’d go in ServerScriptService.

I edited the guide but it gives me an error when I enter it. image