I am trying to teleport a player to a spawn (Which is in the maps) after the game searches for a map and then remove it. Other ways it would kill me but I would go there and they gui would keep popping up. Now an error pops up saying "1 is not a valid member of SpawnLocation"
maps = game.ServerStorage:GetChildren()
local player = game:GetService"Players".LocalPlayer
local guis = player:WaitForChild"PlayerGui"
while wait() do
if game.Players.NumPlayers >= 1 then
guis.ScreenGui.Frame.Map.Visible = false
guis.ScreenGui.Frame.Madeby.Visible = false
wait(3)
ranmap = math.random(1, #maps)
guis.ScreenGui.Frame.Visible = true
guis.ScreenGui.Frame.Beingchosen.Visible = true
wait(1)
chosen = maps[ranmap]
chosenclone = chosen:Clone()
chosenclone.Parent = game.Workspace
guis.ScreenGui.Frame.Map.Visible = true
guis.ScreenGui.Frame.Madeby.Visible = true
guis.ScreenGui.Frame.Madeby.Text = "Map is " .. chosen.Name .. " By: Spoookd"
wait(5)
spawns = chosenclone.SpawnPoint
for i,v in pairs(game.Players:GetPlayers()) do
name = v.Name
check = game.Workspace:FindFirstChild(name)
if check then
checkHumanoid = check:FindFirstChild("Humanoid")
if checkHumanoid then
check:MoveTo(spawns[i].Position)
end
end
guis.ScreenGui.Frame.Visible = false
end
end
end
