Hello! I'm making a game where the players need to be teleported to a map after the script chooses the map. The problem is when I run the game, absolutely nothing happens. How would I go about fixing this? Thanks for stopping by! Here is the script:
local Map1 = game.lighting.Map1 local Map2 = game.lighting.Map2 local Map3 = game.lighting.Map3 function ChooseMap() while true do wait(5) ChooseMap = math.random(1,3) if ChooseMap == 1 then game.lighting.Map1:Clone(game.workspace) for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do if plr.Character then plr.Character:MoveTo(Vector3.new(14.31, 1.61, -151.635)) wait(10) Map1:Destroy() end if ChooseMap == 2 then game.lighting.Map2:Clone(game.workspace) for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do if plr.Character then plr.Character:MoveTo(Vector3.new(23.1, 38.74, 117.9)) wait(10) Map2:Destroy() end if ChooseMap == 3 then game.lighting.Map3:Clone(game.workspace) for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do if plr.Character then plr.Character:MoveTo(Vector3.new(23.1, 72.26, 117.9)) wait(10) Map3:Destroy() wait(10) end end end end end end end end end
The problem is you haven't made the function triggered :l
I recommend you recommend you removing the function part or just copy the script I fixed for you
local Map1 = game.Lighting.Map1 local Map2 = game.Lighting.Map2 local Map3 = game.Lighting.Map3 while true do wait(5) ChooseMap = math.random(1,3) if ChooseMap == 1 then map1z = game.Lighting.Map1:clone() map1z.Parent = game.Workspace for _, plr in pairs(game:GetService("Players"):GetPlayers()) do if plr.Character then plr.Character:MoveTo(Vector3.new(14.31, 1.61, -151.635)) wait(10) map1z:Destroy() end if ChooseMap == 2 then map2z = game.Lighting.Map2:clone() map2z.Parent = game.Workspace for _, plr in pairs(game:GetService("Players"):GetPlayers()) do if plr.Character then plr.Character:MoveTo(Vector3.new(23.1, 38.74, 117.9)) wait(10) map2z:Destroy() end if ChooseMap == 3 then map3z = game.Lighting.Map3:clone() map3z.Parent = game.Workspace for _, plr in pairs(game:GetService("Players"):GetPlayers()) do if plr.Character then plr.Character:MoveTo(Vector3.new(23.1, 72.26, 117.9)) wait(10) map3z:Destroy() wait(10) end end end end end end end end