Gui not showing

Hello Developers! I’m new to scripting and I made a Script but for some reason the Gui isn’t showing but the rest of it is working. I would very appreciate it if you were to tell me what was wrong with it. Here’s the script:

local Map1 = game.ReplicatedStorage.Map1
local GoldenBalls = game.StarterGui.goldenballs.GoldenBalls

while true do
wait(30)
Map1:Clone().Parent = game.Workspace
GoldenBalls.Visible = true
wait(30)
GoldenBalls.Visible = false
game.Workspace.Map1:Remove()
wait(120)

end

First off, what are you trying to execute using the script. Finally, please drag in the code not write it here it’s more simpler to spot mistakes for us.

The reason I believe is cuz ur changing the starter gui. It means that UI will show to anyone who joins but the current in-game players will not see it.

you can’t reference startergui

Do it as:

local GoldenBalls = game.Players.LocalPLayer.goldenballs.GoldenBalls

Also, wrong category, move it into #help-and-feedback:scripting-support

when i try to drag it in it does the same thing, and im using a regular script. not local or module

Yea do what @EternalEthel said which is what i said about the starter gui will only spawn to players who join (the reason why it is called starter). That should change it.

I just wanted to add that if this script is a server script then you will need to fire an client all event and then collect it up in a local script. U then change the code which @EternalEthel put.)

Or u could do a for i, v do loop and loop through all the players to the player gui and then find the UI via the server side but that is less efficient then firing to all clients and doing it via the client side/locals script)

You are referencing the StarterGui instead of the PlayerGui. Do you want the GUI to show for everybody at the same time? Also, is this a server script or a local script?

I want the gui to show for everybody and im using a server script, would it be easier to use a local script instead?

It could be yes but it really depends on how your code work. If u follow what i put above it should work fine if u have a server script.

the only reason why this doesn’t work is line 2, you are supposed to use PlayerGui