I am currently making a party feature, and whenever I reserve a server in a sub game, sometimes it telelports both players fine, sometime it teleports one, or most the time it says Attempt to teleport to a place thats restricted. I cant find anything online anywhere to help except for the fact that this is a roblox issue, and I really hope that isnt the case. Any help is appreciated
--The client side for these are just firing these events from a button click on a UI Element
--Join server
joinServerReq.OnServerEvent:Connect(function(player, id)
local foundServer = serversFolder:FindFirstChild(tostring(id))
if foundServer then
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ReservedServerAccessCode = foundServer.Value
local s, err = pcall(function()
TeleportService:TeleportAsync(partiesPlaceId, {player}, teleportOptions)
end)
if not s then warn(err) end
end
end)
local playersCreating = {}
-- Creating server
createServer.OnServerEvent:Connect(function(player)
-- if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassid) then
if not table.find(playersCreating, player.UserId) then
table.insert(playersCreating, player.UserId)
local data
local success, err = pcall(function()
data = parties:GetAsync("Parties") or HttpService:JSONEncode({})
end)
if success then
task.spawn(function()
data = HttpService:JSONDecode(data)
local newServer = {TeleportService:ReserveServer(partiesPlaceId), player.UserId}
table.insert(data, newServer)
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ReservedServerAccessCode = newServer[1]
parties:SetAsync("Parties", HttpService:JSONEncode(data))
local s, err = pcall(function()
TeleportService:TeleportAsync(partiesPlaceId, {player}, teleportOptions)
end)
if not s then warn(err) end
table.remove(playersCreating, table.find(playersCreating, player.UserId))
end)
else
warn(err)
end
end
-- end
end)