Hello and thank you in advance to anyone who can help me solve this problem.
So the problem Iām actually having is that I managed to put a player in a reserved server and gave the reserved server code to the other player but when I try to teleport the other player to the server reserved, the server tells me that it is an access
restricts but how I can get him to join the already existing reserve server so that he joins the other when he wants.
the goal I want to do is that the player can join when he wants the other player who is in his
server reserve and do not teleport at the same time both player.
local TeleportService = game:GetService("TeleportService")
local messagingService = game:GetService("MessagingService")
local Place_Two = 7392454137
local Find_Player = "SaltoitTestAccount"
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
local splitMsg = string.split(msg, " ")
if splitMsg[1] == "/TP" then
local Code = TeleportService:ReserveServer(Place_Two)
TeleportService:TeleportToPrivateServer(Place_Two,Code,{player})
end
if splitMsg[1] == "/JoinA" then
msg = string.gsub(msg, "/joinA ", "")
local filteredMsg
pcall(function()
filteredMsg = game:GetService("TextService"):FilterStringAsync(msg, player.UserId)
filteredMsg = filteredMsg:GetNonChatStringForBroadcastAsync()
end)
if filteredMsg then
local messageData = {
sender = player.Name,
message = Find_Player
}
messagingService:PublishAsync("Messaging1", messageData)
end
end
end)
messagingService:SubscribeAsync("Messaging2", function(sentData)
local data = sentData.Data
print("PlaceId : "..data.PlaceId)
print("JobId : "..data.JobId)
TeleportService:TeleportToPrivateServer(
data.PlaceId,
data.JobId,
{player}
)
end)
end)
Reserver Server :
local messagingService = game:GetService("MessagingService")
messagingService:SubscribeAsync("Messaging1", function(sentData)
local data = sentData.Data
if game.Players:FindFirstChild(data.message) then
local messageData = {
sender = data.sender,
PlaceId = game.PlaceId,
JobId = game.JobId
}
messagingService:PublishAsync("Messaging2", messageData)
end
end)