MessagingService Release

If I own a group, would I be able to use this in that group’s games since I’m a beta tester, or would it not work because the group owns it, not me?

4 Likes

Very promising for developers who needed cross-server communication! Definitely going to experiment with this new API.

Edit: But, one question i have is that does this mean we can send specific code from one server to another to run said code? or does this only apply to an array?

4 Likes

I don’t think so; they’re two separate entities that fall within the same scope of cross-locational access. MessagingService allows you to send messages to other places and servers in near-real time, while universe scripts are intended to run at a game-level and be able to interact with places and/or instances.

In other news though, looks like my hopes and dreams have been crushed. I’ve toyed around with MessagingService and have come to a realisation that universe scripts are better suited for several of my use cases over MessagingService. I’ll still make good use of it, but rip.

I was so hyped too.

3 Likes

So glad to hear this is coming out. If I am correct and understand this, now we can display public user ban messages like Rainbow Six Siege does with BattlEye, where if a user is banned/kicked from the game for toxicity or cheating it will display at the top right. Of course we can customize it a bit more but I’m interested to see the possible creations of this amazing new feature. Keep up the great work yall.

4 Likes

This is amazing! Previously I would have to send an HTTPRequest to my web app and periodically send get requests to the app to get the data from one server to another. With this it makes it so much easier!

4 Likes

Just released a Public Resource on my findings of cross-server matchmaking using this feature: Cross-Server Matchmaking Module

10 Likes

Amazing! I love this feature that would out a lot with sending server announcements :smiley:

3 Likes

Thanks, this feature will be great!

3 Likes

Thank you thank you thank you!

2 Likes

Finally! I’ve been waiting for this for soooo long! A million thanks!

3 Likes

Hey I don’t know if I’m correct or not but you said:

When from what I can see it actually is possible with what I quickly made:

local MessagingService = game:GetService("MessagingService")
local Players = game:GetService("Players")

local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

local NameColors = {
	Color3.fromRGB(253, 41, 67),
	Color3.fromRGB(1, 162, 255),
	Color3.fromRGB(2, 184, 87),
	BrickColor.new("Bright violet").Color,
	BrickColor.new("Bright orange").Color,
	BrickColor.new("Bright yellow").Color,
	BrickColor.new("Light reddish violet").Color,
	BrickColor.new("Brick yellow").Color
}

local function GetNameValue(Name)
	local Value = 0
	for Index = 1, #Name do
		local OtherValue = Name:sub(Index, Index):byte()
		local ReverseIndex = #Name - Index + 1
		if #Name % 2 == 1 then
			ReverseIndex = ReverseIndex - 1
		end
		if ReverseIndex % 4 >= 2 then
			OtherValue = -OtherValue
		end
		Value = Value + OtherValue
	end
	
	return Value
end

MessagingService:SubscribeAsync("ChatMessages", function(Callback)
	local Name = Callback.Data.Name
	local Message = Callback.Data.Message
	
	if not Players:FindFirstChild(Name) then 
		local EmulatedSpeaker = ChatService:GetSpeaker(Name)
		if not EmulatedSpeaker then
			EmulatedSpeaker = ChatService:AddSpeaker(Name)
			EmulatedSpeaker:JoinChannel("All")
		end
		
		-- For fun let's make the name color the color of the name on the other server!
		EmulatedSpeaker:SetExtraData("NameColor", NameColors[GetNameValue(Name) % #NameColors + 1])
		
		EmulatedSpeaker:SayMessage(Message, "All", {})
	end
end)
	
Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		MessagingService:PublishAsync("ChatMessages", {
			Name = Player.Name,
			Message = Message	
		})
	end)
end)

That all works from one server script and nothing else is required and it works flawlessly. Maybe I am incorrect but it definitely seems like a cross-server chat is possible. Sadly I can’t filter the messages sent to the other server from one server as FilterStringForBroadcastAsync requires the player to be in the server. :frowning:

12 Likes

Can’t wait to play around with this!

1 Like

You could just filter it in the original server.

5 Likes

That is true! Thanks for the tip.

3 Likes

Thank you so much! Removes the need of using datastore for something that it was not really intended to be used for.

10 Likes

FINALLY, global server lists here we come

4 Likes

Great to see this, will this work theouggout other games also? Or just in the same game?

1 Like

It doesn’t seem possible since it will break if too many messages could be sent over the limit per minute if you have say 1000 people in your game.

2 Likes

this is very amazing

3 Likes

Is this place wide, universe/game wide or creator wide? It looks like the middle one but I just wanted to check.

2 Likes