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.
-
First. Put a Remote Event Inside of Replicated Storage and Call it “NewChatFromOtherServer”
-
Go To Starter Player, Then StarterPlayerScripts, Then Insert a Local Script. You Can Call it whatever you like!
-
Insert a Script into ServerScriptService. Call it whatever you like!
Now your Explorer Should Look something like this.
-
Firstly, go into ServerScriptService < ChatsProgram (What Script You Added To ServerScriptService)
-
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.
-
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!
-
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.
- 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!
0 voters