Hello!
I’m currently working on admin panel. This admin panel is activated by a specific message command, followed by server sided checks to ensure the user is admin.
However, when an admin opens this panel, I configured the Roblox Chat API to remove the message from the message channel, as soon as the message was sent, following exactly what it had in their API document (here).
It all works so far, I say the command and it shows the UI. However, as soon as I close the UI, and attempt to open it again, I get an error from a Roblox Script:
MessageLogDisplay:109: attempt to index nil with 'Destroy'
My message never get’s sent, which is the point, but this error keeps coming up, and I have no idea what could be causing it.
This is affecting the popup times of the UI, as the error throws, the actual UI never comes up (I do have a cooldown in place to prevent spamming).
Here is the code module, located in the Client Chat Modules (as the API said).
local util = require(script.Parent:WaitForChild("Util"))
function ProcessMessage(message, ChatWindow, ChatSettings)
if string.sub(message, 1, 6):lower() == "temp101" then
local currentChannel = ChatWindow:GetCurrentChannel()
if (currentChannel) then
currentChannel:RemoveLastMessageFromChannel()
end
return true
end
return false
end
return {
[util.KEY_COMMAND_PROCESSOR_TYPE] = util.COMPLETED_MESSAGE_PROCESSOR,
[util.KEY_PROCESSOR_FUNCTION] = ProcessMessage
}