While working on my project, I have stumbled across a big problem. When in run mode, the text labels work perfectly. But when I play solo, it is stuck. It is stuck on “Choosing Map”
The script is long but here you go:
–[[Chooses a random map using tables
Made by RinxfulROBLOX
12/19/2020, PUT MAPS IN LIGHTING FIRST, PUT SCREEN GUI IN STARTERGUI, PUT SCRIPT INSIDE WORKSPACE]]
local map1 = game.Lighting.Bridge
local map2 = game.Lighting.Forest
local map3 = game.Lighting.Desert
local map4 = game.Lighting.City
local mapText = game.StarterGui.ScreenGui.TextLabel --Whatever map is chosen, the name will be printed here
textIntValue = mapText.IntegerValue.Value
textStringValue = mapText.StringValue.Value
local maps = {map1, map2, map3, map4}
function choseRandomMap()
textStringValue = “Choosing Map…”
mapText.Text = textStringValue
wait(20)
currentMap = maps[math.random(1, #maps)]-- Gets 1 random map out of # of maps, which is 4
currentMap.Parent = game.Workspace
textStringValue = currentMap.Name… " has been chosen!"
mapText.Text = textStringValue
–Getting players on the map
wait(5)
local players= {}
local target = currentMap.SpawnLocation
wait(20)
for i,v in pairs(game.Players:GetChildren())do
table.insert(players, v)
end
for i,v in pairs(players)do
v.Character:MoveTo(target.Position)
end
wait(5)
round()
end
–Round
local roundTime = 30
function round()
for i = roundTime, 0, -1 do – Every second, roundTime will decrease by 1, once it reaches 0, round will end
textIntValue = i
mapText.Text = textIntValue
wait(1)
if i == 0 then
textStringValue = “Round ended!”
mapText.Text = textStringValue
wait(5)
textStringValue = “Starting new round!”
mapText.Text = textStringValue
removeCurrentMap()
wait(5)
choseRandomMap() – New round begins
end
end
end
function removeCurrentMap()
currentMap.Parent = game.Lighting
end
choseRandomMap()