iv'e made a random map changer script and when i try to play it on studio roblox studio crashes and when i play the game the script not working can someone help me fix this? thanks
local map1 = game.ServerStorage.Maps.Map1 local map2 = game.ServerStorage.Maps.Map2 local map3 = game.ServerStorage.Maps.Map3 local map4 = game.ServerStorage.Maps.Map4 local map5 = game.ServerStorage.Maps.Map5
while true do local random = math.random(1, 5) if random == 1 then map1.Parent = game.Workspace map2.Parent = game.ServerStorage.Maps map3.Parent = game.ServerStorage.Maps map4.Parent = game.ServerStorage.Maps map5.Parent = game.ServerStorage.Maps end if random == 2 then map1.Parent = game.ServerStorage.Maps map2.Parent = game.Workspace map3.Parent = game.ServerStorage.Maps map4.Parent = game.ServerStorage.Maps map5.Parent = game.ServerStorage.Maps end if random == 3 then map1.Parent = game.ServerStorage.Maps map2.Parent = game.ServerStorage.Maps map3.Parent = game.Workspace map4.Parent = game.ServerStorage.Maps map5.Parent = game.ServerStorage.Maps end if random == 4 then map1.Parent = game.ServerStorage.Maps map2.Parent = game.ServerStorage.Maps map3.Parent = game.ServerStorage.Maps map4.Parent = game.Workspace map5.Parent = game.ServerStorage.Maps end if random == 5 then map1.Parent = game.ServerStorage.Maps map2.Parent = game.ServerStorage.Maps map3.Parent = game.ServerStorage.Maps map4.Parent = game.ServerStorage.Maps map5.Parent = game.Workspace end end