Hi I am currently trying to create a map changer script... When I come to run it , it doesn't work. The script comes with a Round system as well which teleports people to the maps and back. Help me find this error please! Script :
local players = game.Players:GetChildren()
local maps = game.Lighting.Maps:GetChildren()
local currentmap = game.Workspace:WaitForChild("CurrentMap")
local chosenmap = script:WaitForChild("ChosenMap")
local spawner = game.Workspace:WaitForChild("Spawn")
local choices = {}
function choosemap()
for i = 1,#maps do
if maps[i]:isA("Model")then
table.insert(choices,maps[i])
end
end
local picked = math.random(1,#maps)
chosenmap.Value = choices[picked].Name
end
--Load the map
function loadMap()
local map = game.Lighting.Maps:FindFirstChild(chosenmap.Value)
map:Clone().Parent = currentmap
end
function deleteMap()
for i,v in pairs(currentmap:GetChildren())do
if v:isA("Model") then
v:Destroy()
end
end
end
function teleportPlayers()
for i,v in pairs(players)do
v.Character.HumanoidRootPart.CFrame = currentmap:FindFirstChild(chosenmap.Value).Spawn.CFrame * CFrame.new(math.random(5,10),0,math.random(5,10))
end
end
function teleportBack()
for i,v in pairs(players)do
v.Character.HumanoidRootPart.CFrame = spawner.SpawnLocation.CFrame * CFrame.new(math.random(5,10),0,math.random(5,10))
end
end
while true do
wait(3)
choosemap()
loadMap()
wait(1)
teleportPlayers()
wait(10)
deleteMap()
teleportBack()
end?

2 comments
im very new and i dont understand nothing of the script, maybe there was a () in while true do, because i think it was while true do(), otherwise than that i started scripting a month ago so i dunno
There is no () in while true do