I need some help with my map picker script

Ok so, I wanted to mess around with some things I’ve learned since starting roblox lua, and I tried to make a map picker script. It works, and the map does load, with it saying which map loaded in output, however I wanted it to be on a gui, so I made this script:

local randmap = math.random(1,2)
local IndicatorText = game.StarterGui.Indicator.IndicatorText
local Map1 = game.Workspace.Map1
local Map2 = game.Workspace.Map2

wait(5)

if randmap == 1 then
	Map1.Transparency = 0
	Map1.CanCollide = true
	print("map1 was chosen")
	IndicatorText.TextTransparency = 0
	IndicatorText.Text = "Map1 Was chosen!"
end

if randmap == 2 then
	Map2.Transparency = 0
	Map2.CanCollide = true
	print("map2 was chosen")
	IndicatorText.TextTransparency = 0
	IndicatorText.Text = "Map2 Was chosen!"
end

It doesn’t work, I looked quite a lot on TextLabel, and changed my script a few times, but it just doesn’t work and I want to know why.
Heres my explorer:

and here are the properties of IndicatorText:

Thanks

Every UI inside StarterGui gets cloned inside Player.PlayerGui, that’s what the player sees and interacts with. A solution would be to create a ChosenMap value inside ReplicatedStorage, and every time it changes update the text locally:

--LocalScript inside the Indicator UI
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local UI = script.Parent 
local Label = UI:WaitForChild("IndicatorText") 

local ChosenMap = ReplicatedStorage:WaitForChild("ChosenMap")

function Changed(new)
	Label.Text = new 
	Label.TextTransparency = 0 
	task.wait(3)
	if Label.Text == new then
		Label.TextTransparency = 1
	end
end

task.spawn(function()
	Changed(ChosenMap.Value)
end)
ChosenMap.Changed:Connect(Changed)
--Your script in ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ChosenMap = Instance.new("StringValue", ReplicatedStorage)
ChosenMap.Name = "ChosenMap"

local maps = workspace.Maps:GetChildren() --place all the maps under a "Maps" Folder for easier access
local chosen = maps[math.random(1, #maps)] 

task.wait(5)

chosen.Transparency = 0 
chosen.CanCollide = true 
print(chosen.Name.." was chosen") 
ChosenMap.Value = chosen.Name

You might want to make a folder in the ServerStorage called maps instead, you can clone and load it to the client, which is generally the method you’ll see people use .

local mapsFolder= ServerStorage:WaitForChild("Maps")
local maps: table = mapsFolder:GetChildren()

local mapIndex = math.random(1, #maps) -- #maps is the how many maps are in the table
local randomMap = maps[mapIndex]
local map = randomMap:Clone()
map.Parent = workspace.MapHolder -- good ole mad bloxxer method
print(map.Name .. "was chosen")

Thanks, I’ll look into what you both said, looks like I was doing it all wrong