What do you want to achieve? Fix teleporting in my game.
What is the issue? Whenever i step in the teleporter teleporting takes forever.
What solutions have you tried so far? None, i just reviewed script but couldn’t find anything.
Script that shall teleport you:
local TS = game:GetService("TeleportService")
local TweenService = game:GetService("TweenService")
local placeId = "4890915942" -- Enter a second Id Place.
local leaveGuiEvent = game.ReplicatedStorage.LeaveGuiEvent
local TransitionEvent = game.ReplicatedStorage.TransitionEvent
local list = {}
local billboard = script.Parent.billboardPart.billboardGui
local timer
local teleporting = false
local spawnTeleport = script.Parent.spawn
local function updateGui()
billboard.Frame.players.Text = "Players: " ..#list.. "/16" -- Change the number 16 according to the Max Player who want to be teleported.
end
local function removeFromList(character)
for i=1,#list do
if list[i] == character.Name then
table.remove(list,i)
updateGui()
end
end
end
local function teleportPlayers()
if #list > 0 then
billboard.Frame.Status.Text = "TELEPORTING"
billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
local playersToTeleport = {}
local teleportTime = 0
for i=1,#list do
if game.Players:findFirstChild(list[i]) then
table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
else
table.remove(list,i)
end
end
local code = TS:ReserveServer(placeId)
teleporting = true
TS:TeleportToPrivateServer(placeId,code,playersToTeleport)
repeat wait() until #list <= 0
billboard.Frame.Status.Text = "READY"
billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
teleporting = false
end
end
script.Parent.Gate.Touched:Connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") then
if teleporting == false then
local char = hit.Parent
local player = game.Players:FindFirstChild(char.Name)
local alreadyExists = false
for i=1,#list do
if list[i] == char.Name then
alreadyExists = true
end
end
if alreadyExists == false then
if #list < 16 then -- Many Players have been teleported.
table.insert(list,char.Name)
char.PrimaryPart.CFrame = spawnTeleport.CFrame
updateGui()
leaveGuiEvent:FireClient(player)
end
player.CharacterRemoving:connect(function(character)
removeFromList(character)
end)
end
end
end
end)
leaveGuiEvent.OnServerEvent:Connect(function(player)
if player.Character then
player.Character.HumanoidRootPart.Anchored = false
wait()
player.Character.Humanoid.Jump = true
wait()
player.Character:MoveTo(game.Workspace.leaveRoomPart.Position)
removeFromList(player.Character)
end
end)
while wait() do
timer = 31
for i=1,timer do
timer = timer - 1
billboard.Frame.time.Text = timer
wait(1)
end
teleportPlayers()
end
The problem might just be how Roblox loads the player into the next world, which takes kinda long because of servers. However, you make this wait look and feel less weird by making a loading screen with gui.
I had party gui before this and it said Attempted to teleport to a place that is restricted error code 773 maybe behind the gui there is the same error code 773?
I haven’t done much teleporting script yet, however, I think you should just troubleshoot the whole script.
Try making a normal teleport by maybe following this video.How to Teleport Players to a Different Roblox Game - Roblox Studio Tutorial - YouTube
Then after that, you can edit it to make a list of all the players to teleport and teleport them one by one.
? Aren’t you making a table of people to teleport to a private server, if so you could just get each player from that list and teleport them singly while using the script in the video.