If this is really what you are using… I don’t know how you can stand having a global variable that isn’t defined and also why is it like that just use the script like this bro
local teleportservice = game:GetService("TeleportService")
local replicatedstorage = game.ReplicatedStorage
local escapeguione = replicatedstorage:WaitForChild("EscapeGuiOne")
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent.Humanoid
local colony = hit.Parent.Colony
local arrayofplayers = {
}
local teleportdata = {
}
for i, v in pairs(game.Players:GetPlayers()) do
if v.Character:WaitForChild("Colony").Value == colony.Value and colony.Value ~= "" then
if game.ReplicatedStorage.ColonyStuff:FindFirstChild(colony.Value).MemberPermsFolder.MembersCanExit.Value == true or game.ReplicatedStorage.ColonyStuff:FindFirstChild(colony.Value).ColonyLeaderValue.Value == humanoid.Parent.Name then
table.insert(arrayofplayers, v)
teleportdata[v.Name] = {v.Name}
for i, v in pairs(teleportdata) do
print(v)
end
table.insert(teleportdata[v.Name], "VColonyValue")
teleportdata[v.Name].VColonyValue = v.Character.Colony.Value
print(teleportdata[v.Name].VColonyValue)
for i, v in pairs(teleportdata) do
print(v)
--for e, t in pairs(teleportdata[v.Name]) do
--print(t)
--end
end
end
elseif v.Character.Name == hit.Parent.Name then
teleportservice:Teleport(98985454249054, game.Players:GetPlayerFromCharacter(hit.Parent))
print("teleported one player not in a colony")
end
end
local teleportoptions = Instance.new("TeleportOptions")
teleportoptions:SetTeleportData(teleportdata)
teleportservice:TeleportAsync(98985454249054, arrayofplayers, teleportoptions)
end
end)