Command / Utility logs (Basic Admin Essentials)

Hello! My name is James, and I am making a game where people hang out and chill.

But, there are a lot of people who ruin the fun for everybody, and there are also people who violate the TOS of Roblox. And I want to be a command system for people who reached a certain point in the group and they can help the admins supervise the game.

So I made a command textbox, it currently only has:
Kick and Respawn , (this part isn’t that important.)

So, I know that basic admin has logs (AKA list) that show’s what people did.
Chatlog: Show what other people have said in the chat.
Log: Shows commands that other people have used.
Ingame admin: Show everyone in the server that has admins.

I have tried searching up on the dev forum for a long time, but people only talk about copy and paste logs and it has nothing to do with utility logs.

So what I want to do:
I wanted to make a log that when people type into a textbox (Command bar) it will log what they typed in the textbox.

My script(s):

  1. Making a list.
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 = 'Utilitylog'
	local pluginPrefix = Prefix
	local pluginLevel = 2
	local pluginUsage = "<User(s)>" -- leave blank if the command has no arguments
	local pluginDescription = "Utility Log ./n Check the utility log"
	
	-- Example Plugin Function --

	local pluginFunction = function(Args)
		local Player = Args[1]
		remoteEvent:FireClient(Player, 'List', 'Utility Log', true, true, {})
	end

	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

My utility client:

local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local UI = script.Parent.Parent.Utilites
local Input_Frame = script.Parent.Input
local output_Frame = script.Parent.Output
local LaunchButton = script.Parent.LaunchButton

local function onInputEnded(input, gameProcessed)
	if gameProcessed then
		return
	end
	if input.KeyCode == Enum.KeyCode.H then
		local tween = TweenService:Create(Input_Frame, TweenInfo.new(0,5, Enum.EasingStyle.Sine), {Position = UDim2.new(0, 0, 0.45, 0)})
		tween:Play()
		local function onCompleted()
			print("Tween finished.")
		end
		tween.Completed:Connect(onCompleted)
	end
end
UserInputService.InputEnded:Connect(onInputEnded)

game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(key)
	if key == "" then
		Input_Frame:CaptureFocus()
		spawn(function()
			Input_Frame.Text = ""
		end)
	end
end)

Input_Frame.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		game.ReplicatedStorage.Remotes.ExecuteCommand:FireServer(Input_Frame.Text)
		print("Command Executed")
		Input_Frame.Text = "Type in command, or type cmds for help."
		local tween2 = TweenService:Create(Input_Frame, TweenInfo.new(0.5,Enum.EasingStyle.Sine), {Position = UDim2.new(0,0,-1,0)})
		tween2:Play()
		local function onCompleted2()
			print("Tween2 Finished")
		end
		tween2.Completed:Connect(onCompleted2())
	end
end)
UserInputService.InputEnded:Connect(onInputEnded())

My utility server script:

local Admins = {"James_Playz2019"} -- Still testing so it's only me.
local Prefix = ""

function CheckAdmin(name)
	for i, v in pairs(Admins) do
		if v == name then return true
		end
		return false
	end
end
local function getPlayerFromPartialName(PartialName)
	local foundName = nil
	local Players = game.Players:GetPlayers()
	for i = 1, #Players do
		local PossiblePlayer = Players[i]
		if string.find(string.lower(PossiblePlayer.Name), string.lower(PartialName)) then
			foundName = PossiblePlayer.Name
		end
	end

	if not foundName then
		return nil
	else
		return foundName
	end
end
function setOutput(plr, text)
	game.StarterGui.Utilites.Output.Text = tostring(text)
	wait(5)
	game.StarterGui.Utilites.Output.Text = "This player is not in the game." ---- the plr. was never found
end
function ExecuteCommand(cmd, plr)
	local Args = cmd:split(" ")
	if Args[1] == ("Respawn") then
		local SecondPlayer = getPlayerFromPartialName(Args[2])
		if SecondPlayer ~= nil then
			game.Players:FindFirstChild(SecondPlayer):LoadCharacter()
			print(Args[2])
		else
			setOutput(plr, "Player Not Found, "..tostring(Args[2]))
		end
	elseif Args[1] == ("Kick") then
		local SecondPlayer = getPlayerFromPartialName(Args[2])
		if SecondPlayer~= nil then
			game.Players:FindFirstChild(SecondPlayer):Kick("\nYou have been kick by a staff member.")
		end
	end
end

game.ReplicatedStorage.Remotes.ExecuteCommand.OnServerEvent:Connect(function(plr, cmd)
	if CheckAdmin(plr.Name) then
		ExecuteCommand(cmd, plr)
	else
		setOutput(plr, "Invalid Permission Level")
	end
end)

Thank you to anyone who helped / tried to help. :smiley:

3 Likes

You would need to make something that stores the logs.

Yea, I want to store the logs in utility log, it doesn’t have to save, is it not possible?