Why is my messaging service script not work?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I am attempting to make a global messaging system.

  1. What is the issue? Include screenshots / videos if possible!

I get no errors but for some reason it doesnt print anything…

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked over the developer hub documentation and it looks fine to me. I also know I need to pcall it but I am going to implement that once I get the basic function done.

local MessagingService = game:GetService("MessagingService")

local Topic = "ShutdownEvent"

MessagingService:SubscribeAsync(Topic, function(message)

print(message.Data)

end)

game.Players.PlayerAdded:Connect(function(player)

wait(1)

MessagingService:PublishAsync(Topic, "jake has entered the game")

end)

Are you running the script on Studio?

I fixed it. I dont know how but I just re did the whole thing and now it sends fine.

1 Like