I was trying to create a radio system, and I built it like this:
- I created a test part, which should be the radio, and put it inside an accessory. Inside the part there is a localscript called “RadioScript” (and put it in ServerStorage because, with an hat giver, the radio clone and parent it to character);

- I also created a ScreenGUI in the StarterGUI, with a frame inside with BackgroundColor3 (255, 0, 0) and a localscript.

Returning to RadioScript, the script works that if the BackgroundColor3 of the frame is (0, 255, 0) (green), when the player writes something, a part renamed “TestRadioPart” will display what the player said (via the “Chat” service). The script is as follows:
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local radioGui = playerGui:WaitForChild("Radio")
local frame = radioGui:WaitForChild("Frame")
local lastMessage = nil
local testUscitaRadio = workspace.TestRadioPart
game.TextChatService.OnMessageAdded = function(msg)
if frame.BackgroundColor3 == Color3.fromRGB(0, 255, 0) and msg.Status == Enum.TextChatMessageStatus.Success then
game:GetService("Chat"):Chat(testUscitaRadio, msg.Text, Enum.ChatColor.Red)
lastMessage = msg.Text
end
end
Everything works, however, when the player who had the radio dies, he can no longer write in chat and output a warn:
Error occurred while calling TextChatService.OnIncomingMessage: Script that implemented this callback has been destroyed while calling async callback
I read another forum with the same problem, and I tried using “OnMessageAdded” instead of “OnIncomingMessage”. However, the output gives an error:
OnMessageAdded is not a valid member of TextChatService “TextChatService”
Then I tried using CharacterAdded, but it only gets worse since the TestRadioPart no longer works.
I no longer know what to try to make it work, which is why I want to ask someone more experienced for help who can help me.
P.S. I would like to point out that I am a beginner, so I apologize in advance if the organization of the system is not one of the best😭
P.P.S. Idk if this can help, i don’t think, but there is the localscript of the GUI:
local frame = script.Parent.Frame
local plr = game:GetService("Players").LocalPlayer
local radio = plr.Character:WaitForChild("Radio")
game:GetService("UserInputService").InputBegan:Connect(function(key, gPE)
if radio.Parent == plr.Character then
if gPE then return end
if key.KeyCode == Enum.KeyCode.T then
if frame.BackgroundColor3 == Color3.fromRGB(255, 0, 0) then
frame.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
elseif frame.BackgroundColor3 == Color3.fromRGB(0, 255, 0) then
frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
end
end
end
end)
local hum = plr.Character:WaitForChild("Humanoid")
hum.Died:Connect(function()
frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
end)