Help With Updating and Setting TextLabels

local mapHolder = game:GetService("ServerStorage").MapHolder
local Children = mapHolder:GetChildren()
local Index = math.random(1,#Children)
local randomInt = Children[Index]

local finalMap = mapHolder:FindFirstChild(randomInt.Name):Clone()   
finalMap.Parent = workspace

game.StarterGui.ScreenGui.DisasterLabel.Text = "The Map Is " .. finalMap.Name

Hey ya’ll! I’m a very new programmer so I followed this tutorial in order to make a random map selector. The code above is part of a script in that tutorial.
The script is in ServerScriptService, MapHolder is a folder of maps in serverStorage and ‘DisasterLabel’ is in starterGUI.
The code that changes the text of DisasterLabel (that i wrote myself, hence the issues) does nothing. I realized that text in a TextLabel can only be changed with a localScript in the label itself, but I have no clue how I’d communicate between the two scripts in order to change the text. Any help?

If anything is unclear, hmu. I may have forgotten details.

Thanks in advance!

You’re going to have to change each player’s PlayerGui.
It’s preferable to change text locally, but I believe it’s fine for this case to change it on the server.

Try this:

local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local mapHolder = ServerStorage.MapHolder

local Children = mapHolder:GetChildren()
local Index =, #Children)
local randomInt = Children[Index]

local finalMap = mapHolder:WaitForChild(randomInt.Name):Clone()   
finalMap.Parent = workspace

for i, player in ipairs(Players:GetPlayers()) do
		local PlayerGui = player:WaitForChild("PlayerGui", 5)

		if not PlayerGui then

		PlayerGui.ScreenGui.DisasterLabel.Text = "The Map Is ".. finalMap.Name
1 Like