Feedback on F9-Style console

Hello I’m currently working on a debug console for my new anti-cheat “Reflex”.
And I’m in the process of making a module that will allow the server to post messages to the console that’s a GUI on the client.

Could anyone review the code and give feedback on how to improve it or make it better, thanks!

  • BugleBoy
local HttpService = game:GetService("HttpService")

local REFLEXConsole = {}

function REFLEXConsole.AddMessage(Player: Player, Message: string, Color: Color3)
	-- // Apply Settings.
	local UIClone = script.MessageTemplate:Clone()
	UIClone.Text = tostring(" "..Message)
	UIClone.TextColor3 = Color
	UIClone.Name = HttpService:GenerateGUID(false) -- // UIClone ID
	
	UIClone.Parent = Player:WaitForChild("PlayerGui").ReflexUI.C_UI.C_ATB_UI.C_ATB_Alerts_UI -- // Parent the message to the player.
	
	return UIClone.Name -- Return: Return the UIClone ID (this will be used to identify the message)
end

function REFLEXConsole.RemoveMessage(Player: Player, MessageID: string)
	for i,v in pairs(Player:WaitForChild("PlayerGui").ReflexUI.C_UI.C_ATB_UI.C_ATB_Alerts_UI:GetChildren()) do
		if v.Name == MessageID then
			v:Destroy() -- // If message found with MessageID then delete it.
		end
	end
end
	
return REFLEXConsole

Preview:

1 Like

there’s not much to say or improve as this is a pretty short script, all i can think of is cleaning it up a bit, like removing pairs( ) from the for loop inside of RemoveMessage() (recent roblox update removes the need for pairs or ipairs), and maybe make a variable for PlayerGui.ReflexUI instead of typing it out every time, but those mostly rely on personal preference

4 Likes

Thanks, I soon plan on making a edit function to allow the server to edit messages already sent out.
Also never knew about this (recent roblox update removes the need for pairs or ipairs)
Thanks for telling me!

1 Like

While you should always avoid tables with mixed key types, if you do need to iterate only numerical keys (e.g. over the results of table.pack) then ipairs still makes sense to use.

??? wdym im so confused?!
.@4393

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.