KashTheKingYT

Messaging Service

Oct 23rd, 2022
2,084
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | Source Code | 0 0
  1. local messagingService = game:GetService("MessagingService")
  2.  
  3. local connection
  4.  
  5. function event(message)
  6.     local eventName = message["Data"]
  7.     if eventName == "purple" then
  8.         game.Workspace.Part.BrickColor = BrickColor.new("Bright violet")
  9.     elseif eventName == "blue" then
  10.         game.Workspace.Part.BrickColor = BrickColor.new("Baby blue")
  11.     end
  12.     connection:Disconnect()
  13.     wait(10)
  14.     establishConnection()
  15. end
  16.  
  17. function establishConnection()
  18.     connection = messagingService:SubscribeAsync("event", event)
  19. end
  20.  
  21. establishConnection()
  22.  
  23. --[[
  24.  
  25. local message = {
  26.     ["Data"] = "purple",
  27.     ["Sent"] = 16615115.161
  28. }
  29.  
  30. ]]
Advertisement
Add Comment
Please, Sign In to add comment