hi, im trying to make a map changing script for my game but the script isn't working. i got the script from a tutorial and followed all the steps carefully (added a folder called 'CurrentMap' named the bottom of the map 'Surface' put blocks on each map called 'Spawn' named the maps Map1, Map2 and Map3 and put all the maps into Lighting.)
Here is the 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.Valeu = choice[picked].name
end
function loadmap()
local map = game.Lighting.maps.FindFirstChild(chosenmap.Value)
map:Clone().Parent = currentmap
end
function deleteMap()
for i,v in pairs(currectmap:GetChilderen())do
if v:isA("model")then
v:Destroy
end
end
end
function teleportPlayer()
for i,v in pairs(players)do
v.Character.HumanoidRootPart.CFrame =
currectmap: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.Caracter.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?
Let me know if you find a spelling error or if this script is outdated. thanks in advance from poopypigeon245.

2 comments
ClassNames should always be capitalized. v:IsA("model") should be v:IsA("Model")
i looked through the script and tried to type everything i could find how it is in workspace but it still isn't working