In my game, I am using text chat service. I am trying to add a leave/join message inside the game. I have made it so that when I join or leave the game, it says I joined or left in a different color, however, when I joined the game, nothing gets sent in the chat. The weird thing is, there are no errors in the output console. This is what I have tried.
SERVER
local remoteEvent = game:GetService("ReplicatedStorage").JoinLeaveRE
game.Players.PlayerAdded:Connect(function(plr)
if (plr.UserId == 1274540012) then
remoteEvent:FireAllClients(plr,"[OWNER] "..plr.Name.." joined the game!")
else
remoteEvent:FireAllClients(plr,plr.Name.." joined the game.")
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
if (plr.UserId == 1274540012) then
remoteEvent:FireAllClients(plr,"[OWNER] "..plr.Name.." left the game.")
else
remoteEvent:FireAllClients(plr,plr.Name.." left the game.")
end
end)
CLIENT
local remoteEvent = game:GetService("ReplicatedStorage").JoinLeaveRE
local chat = game:GetService("TextChatService")
local channel = chat:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")
remoteEvent.OnClientEvent:Connect(function(plr,message)
channel:DisplaySystemMessage("<font color='#04D9FF'>"..message.."</font>")
print("PLEASE WORK")
end)
-- #04D9FF

4 comments
If your not getting errors usually it has to be an error in the script where the remote event was sent to. Not the one that sends the remote event this is just going by my past experiences with remote events.
Hope this helps you find the error. I don't really know much about textchatservice.
I checked both the server and the client but they didn't have any errors.
Weird