Why do I get this error for DisplaySystem message() function?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I don’t want any errors
  2. What is the issue? Include screenshots / videos if possible!
    Errors occur and the error is about a coroutine and resuming a non suspended one
--  When it first runs it works fine. But the second times these errors pop up


-- cannot resume non-suspended coroutine; Error occurred while calling TextChatService.OnIncomingMessage: cannot resume non-suspended coroutine     
 






local success, result = pcall(function()
					local systemchannel = textchatservice:WaitForChild("TextChannels"):FindFirstChild("RBXSystem")

					systemchannel:DisplaySystemMessage("Wait: "..tostring(amount).." seconds until you can send another message.")
					
					return systemchannel
				end)

Where is this code located? Did you edit part of the chat code to do this?

this code is located in a local script. and I did not edit any part of the chat code to do this. But I am also using textchatservice

Can you post a screenshot of the full error that you see in the output?

okay I willl send a screenshot

It looks like some of the error is cut off at the bottom. Can you resize the output window to show the full error?

that is the full error from the error message

Ok, can you try running the code again and screenshotting any errors? Also, what are you trying to accomplish with this script?

first, there are no present errors with this script and second I trying to make that when a player holds a tool and chats a custom chat command, a remote event will fire. After the event is fired successfully, there will be a debounce of 30 s until the player can chat the custom chat command and it will display a system message of waiting 30s.

Also: The custom chat command is the text from the player that is typing in the chat input bar

I see, to solve the error you have, try something like this:

local systemchannel = textchatservice:WaitForChild("TextChannels"):FindFirstChild("RBXSystem")

if systemchannel and systemchannel:IsA("TextChannel") then
	systemchannel:DisplaySystemMessage("Wait: "..tostring(amount).." seconds until you can send another message.")
else
	print("No text channel found :(")
end

I will test it out in studio to see if works

I still get the same error from the previous

I also forgot to mention that all of this script is in a function, which is in a coroutine

Screenshot the whole error so I can see it, please.

the screen shot I sent is the whole error

How are you handling the coroutine?