MessagingService fails

So I have 2 places where you can teleport to one another. Let’s call the place where you normally spawn first in the game the “Main” place and the secondary place where you can teleport “Place B”. I’ve done 2 scripts using MessagingService to send a message from Place B to the main place of how many players are in Place B.

First script (in Place B):

if game.PrivateServerId == "" and game.PrivateServerOwnerId ~= 0 then return end

local MessagingService = game:GetService("MessagingService")

local function update(player)
	MessagingService:PublishAsync(game.PrivateServerId, #game.Players:GetPlayers())	


The first script is supposed to send a message to the main place about the number of players it currently handles. Thing that it misses completely.

Second script (Main Place):

local messagingService = game:GetService("MessagingService")

messagingService:SubscribeAsync("gameId", function(message)
	script.Parent.Text = "Place B\n" .. .. "/" .. game.Players.MaxPlayers

gameId on line 3 is the private server Id.

I don’t really know what is really the problem the output doesn’t seem to print anything and yes I’ve tested it in the game itself on Roblox Player but again no results. I’ve just began with TeleportService so If I haven’t provided enough information feel free to specify. Appreciating any possible solution :slight_smile:

This might sound ridiculous but what I was actually missing was simply a letter… Yeah a letter… At the second script it should’ve been .Data instead of .data. So yeah remember to watch out even for small mistakes and typos like this!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.