Chat Assistant - The Next Way To Communicate With Others

Chat Assistant

Chat Assistant Is The Next Program For Global Communication! Chat Assistant Uses Messaging Service to Communicate With Other Servers! If you and your friend get separated in Servers, then you can Communicate! The Message In Chat Pops Up Just like a Real Chat! Works With Filtering Enabled.

  1. First. Put a Remote Event Inside of Replicated Storage and Call it “NewChatFromOtherServer”
    image

  2. Go To Starter Player, Then StarterPlayerScripts, Then Insert a Local Script. You Can Call it whatever you like!
    image

  3. Insert a Script into ServerScriptService. Call it whatever you like!
    image

Now your Explorer Should Look something like this.
image

  1. Firstly, go into ServerScriptService < ChatsProgram (What Script You Added To ServerScriptService)

  2. Open up the Script, and type the Following:

     local function IsPlayerInGame(player)
    local Var  = false 
        for i,v in pairs(game.Players:GetPlayers()) do
     if v.Name == player then
     	Var = true
        end
     end
     wait()
    if Var == true then
     return true
    elseif Var == false then
      return false
    end
    end
    

This Will Tell The Game if the Player Is In The Server, so the message doesn’t appear twice.

  1. In The Same Script, type the Following:

            game.Players.PlayerAdded:Connect(function(plr)plr.Chatted:Connect(function(msg)
    local Filter = game.Chat:FilterStringForBroadcast(msg,plr)
    local Data = {plr.Name,Filter}
    local Code = game.HttpService:JSONEncode(Data)
      local MS = game:GetService("MessagingService")
      MS:PublishAsync("Chat",Code)
          end)end)
    

The Filter Is There To Filter The Text, the Data is a Table of the Player’s Name and the Text. Next, We Encode the Data so we can transfer it thru messaging service. We Publish The Code into the Service to the other servers. You Can Change the Chat To Whatever Channel You Like, But Make Sure to Remember!

  1. Below the Code, Write the Following:

    game:GetService("MessagingService"):SubscribeAsync("Chat",function(Data)
     local Info = Data.Data
     local NewInfo = game.HttpService:JSONDecode(Info)
     local PlrthatSentMessage = NewInfo[1]
    local MessageInfo = NewInfo[2]
     if IsPlayerInGame(PlrthatSentMessage) == false then
         	game.ReplicatedStorage.NewChatFromOtherServer:FireAllClients(PlrthatSentMessage,MessageInfo)
     end
      end)
    

The Info is Added because the Data is a Table of the Data and the time the message was sent. To Get the Data, we used Data. Data. New Info is used to Decode the Message Sent because we couldn’t use a Table. PlrThatSentMessage is now being used to Seperate the player from the other Contents in the Table. MessageInfo separates the message from the rest of the table. if IsPlayerIsInGame is being used so there isnt messages in the chat twice. To Make the message, we are using Replicated Storage and Firing all Clients.

  1. Now to make the Message! Go into the Local Script and write the Following:

https://gist.github.com/BabycornMain/989ff799c7c564e7eaaa0c0674a1b115

We Use StarterGui to make a SystemMessage. You Can Change the Font to what you choose.
Please don’t claim as your own! I and babycorndog10 developed this ourselves! If Possible, give us credit.

Was This Tutorial Helpful?

  • Yes
  • No
  • In The Future! :slight_smile:

0 voters

11 Likes

Hey! This seems awesome! :slight_smile: Could you send some screenshots? It’s hard to understand how it works.



This is the ServerStorageScript


This is the Local Script.

Hope it helps! :slight_smile:

I meant it in action. I would like to see how it looks from the user perspective.

Ok! Ill send over Pictures (I’m not sure how to Send Videos).

1 Like

This is very helpful for beginners who want to learn more in studio. Great work.

Thanks a lot! It took a bit, but I got it to work! I never tested it with the IsPlayerInServer feature. Im testing it right now.

image


Sorry about the 2nd Photo’s Image Quality! I used my phone.

4 Likes

Testing Came Back Good! It works! I hope it helped!

I hope this is helpful! It’s very nice, I wish developers would use it because I sometimes play a game, but we get separated, but I still want to talk with them, so it’s nice to have this if it gets added so I can communicate with them while being in separate Servers!

2 Likes