DrawingJhon

CrossServer function

Aug 5th, 2020 (edited)
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. local mess = game:GetService("MessagingService")
  2. local Players = game:GetService("Players")
  3.  
  4. local msg_topic = "TestMessaging141"
  5.  
  6. local success, err = pcall(function()
  7.     mess:SubscribeAsync(msg_topic, function(msg)
  8.         local table = msg.Data
  9.         if table.JobId ~= game.JobId then
  10.             print(table.Msg)
  11.         end
  12.     end)
  13. end)
  14.  
  15. if not success then warn(err) end
  16.  
  17. owner.Chatted:Connect(function(msg)
  18.     local table = {
  19.         JobId = game.JobId;
  20.         Msg = "["..owner.Name.."]: "..msg;
  21.     }
  22.     mess:PublishAsync(msg_topic, table)
  23. end)
Add Comment
Please, Sign In to add comment