Hey so i am making a script to allow players to invite their friends to a party from more than one server. The script runs perfectly fine but i get the error “Cannot teleport to a place that is restricted Code 773” when i know for sure it’s public and accessible. Please help!
local success,err = pcall(function()
SubscribeConnection = MessagingService:SubscribeAsync(InvitesTopic,function(message)
print(message.Data)
for _,v in pairs(game.Players:GetPlayers()) do
if (v.UserId) == tonumber(message.Data.UserID) then
local GUIToPrompt = v.PlayerGui:WaitForChild("Invite")
GUIToPrompt.Enabled = true
GUIToPrompt.Frame.Description.Text = message.Data.Inviter.." has invited you to join their room. If you accept, you will be teleported to their server."
GUIToPrompt.Frame.PlaceID.Value = tonumber(message.Data.PlaceID)
GUIToPrompt.Frame.JobID.Value = tonumber(message.Data.JobID)
GUIToPrompt.Frame.Accept.MouseButton1Click:Connect(function()
local TPData = {
["InviterName"] = message.Data.Inviter,
["InviterID"] = message.Data.InviterID
}
TS:TeleportToPlaceInstance(GUIToPrompt.Frame.PlaceID.Value,GUIToPrompt.Frame.JobID.Value,v,v.Name,TPData)
warn("Teleporting"..v.Name.."...")
end)
GUIToPrompt.Frame.Decline.MouseButton1Click:Connect(function()
GUIToPrompt.Enabled = false
end)
break
end
end
end)
end)
SendInviteEvent.OnServerEvent:Connect(function(plr,UserIdToFind)
local Userfound = false
local success,err = pcall(function()
for _,v in pairs(game.Players:GetPlayers()) do
if v.UserId == UserIdToFind then
Userfound = v
break
end
end
end)
if Userfound ~= false then
print("In server")
else
local Data = {
["UserID"] = tostring(UserIdToFind),
["JobID"] = tostring(game.JobId),
["PlaceID"] = tostring(game.PlaceId),
["Inviter"] = plr.Name,
["InviterID"] = tostring(plr.UserId)
}
MessagingService:PublishAsync(InvitesTopic,Data)
end
end)