trying to make like one of them story type games, and I’m having trouble w the teleportation from the lobby to the server.
local WaitTimePod1 = game.ReplicatedStorage.WaitTimePod1
local RegionPod1 = workspace.Pod1:WaitForChild("RegionPod1")
local TeleportService = game:GetService("TeleportService")
local Found = false
local maxWait = 30
local playerTable = {}
game.Players.PlayerAdded:Connect(function(player)
print('code runs again')
while wait() do
if WaitTimePod1.Value > 0 then
wait(1)
WaitTimePod1.Value = WaitTimePod1.Value - 1
if WaitTimePod1.Value == 0 then
local region = Region3.new(RegionPod1.Position - (RegionPod1.Size/2), RegionPod1.Position + (RegionPod1.Size/2))
local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, player.Character:GetDescendants())
if #parts == 0 then
WaitTimePod1.Value = maxWait
end
for _, part in pairs (parts) do
if part:FindFirstAncestor(player.Name) then
table.insert(playerTable, player)
Found = true
break
else
WaitTimePod1.Value = maxWait
Found = false
end
end
if Found == true then
WaitTimePod1.Value = maxWait
TeleportService:TeleportPartyAsync(5088845478, playerTable)
game.Workspace.Pod1.PopupGui.PlayerAmtGui.TextLabel.Text = 'Teleporting...'
wait(5)
end
end
end
end
end)