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: