I'm trying to use Messaging service to give the Teleport Data to another game, Game 1 teleports you to game 2 but also sends the message. Game 2 is supposed to Receive the message and give the location if the message is given.
I'm doing this method to grab multiple Teleport Data into 1 game.
(Script in part of click detector in first game)
local placeID_1 = 4505065903
local placeID_2 = 4483453486
local TeleportService = game:GetService("TeleportService")
local Ms = game:GetService("MessagingService")
local Message = ("Why")
Ms:SubscribeAsync("TeleportService",function(Message)
print(Message.Data)
print(Message.Time)
end)
script.Parent.MouseClick:Connect(function(player)
TeleportService:Teleport(placeID_1, player)
end)
script.Parent.MouseClick:Connect()
This is where you click on the brick and it teleports you, but it also Subscribes the message into TeleportService
(Local Script in StarterGui of second game)
local Data = game:GetService("TeleportService"):GetLocalPlayerTeleportData()
local MS = game:GetService("MessagingService")
MS:PublishAsync("TeleportService", function(Message)
game:GetService("TeleportService"):GetLocalPlayerTeleportData(Message)
game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(-232.3, 148.4, -236.85)
end)
This is where it publishes it and grabs the data and moves your player to the designated location
It teleports you to the game and stuff, but it doesn't teleport your character to the designated location and then it says this in the developer console output: --Messaging service can only be executed by game server

2 comments
use a remote event to execute it on the server. because it wont let it work on client for safety reasons.
How do I call it in Remote event?