GUI not showing intermission time?

I made a test script where the GUI changes to the intermission time, but nothing happens. Here is the code.

local RoundGui = game.StarterGui.RoundGui
local IntermissionTime = 20
RoundGui.Frame.TextLabel.Text = "Intermission " + IntermissionTime + " Seconds"
1 Like

should be

local RoundGui = game.StarterGui.RoundGui
local IntermissionTime = 20
RoundGui.Frame.TextLabel.Text = "Intermission "..IntermissionTime.." Seconds"
3 Likes

thank you, but do you know why this is not working?

local RoundGui = game.StarterGui.RoundGui
local IntermissionTime = 20
while wait(1) do
RoundGui.Frame.TextLabel.Text = "Intermission: "..IntermissionTime.." Seconds"
IntermissionTime = IntermissionTime - 1
end

is that a local or a normal script

it is the normal script, i tried local too

These might sound dumb but…
Is the gui even showing up? You might have to add a line to tween it in or make it visible.

You are also referencing StarterGui and not PlayerGui

Are you trying to change the Gui for the player? If so, then why is the RoundGui referring to the StarterGui, and not the PlayerGui?

1 Like

I want the GUI to show for everyone one the screen

For that you can create a remote event.
Fire this event to do changes to player gui for all players using :FireAllClients

2 Likes

If you’re doing that, then you have two ways to accomplish that: either have it in ServerStorage and clone it to each player as they join (more difficult), or have it in StarterGui, and simply update the intermission time when a player joins. This will require a remote event, as Jech pointed out, to properly synchronize the time.

The issue in your original script is that you’re referencing StarterGui, not PlayerGui as Lightning pointed out. When a player joins the game, the contents of StarterGui are copied into PlayerGui, a sort of “folder” that each player will have.

If your script is inside the RoundGui, you could reference it with script.Parent or something similar.

1 Like

If that script is in the Server Script Service then to change the gui for all of the players do:
You can create a String Value for the Gui, and change the value from the Server Script Service
and in the gui, create a local script, that changes the gui’s text to the value, every time the value changes.
like:

local value = game:GetService("ReplicatedStorage").StringValue
script.Parent.Text = value.Value
value:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = value.Value
end)

In this case, the local script is inside the Text Label

1 Like

I have done this as well

local RoundGui = game.StarterGui.RoundGui
local IntermissionTime = script.IntermissionTime
for i=20,1,-1 do
    RoundGui.Frame.TextLabel.Text = "Intermission: "..IntermissionTime - 1 .." Seconds"
    wait(1)
end

Create a string value in the Replicated storage, change the value’s value to the intermission’s text, and get the value from the player’s gui. like I showed in the post before
I have done things like that many times, it worked for me

1 Like

StarterGui is nothing other than a folder that houses what gets copied to players’ guis.
The contents are cloned and parented to somePlayer.PlayerGui
It is also highly inadvisable to be manipulating GUIs on the server’s side (for a multitude of reasons). Find some way to send the time values from the server to the client, whether it be via remote events, values, or whatever. Then, on the client, change the text to match. What I usually do is send some sort of timestamp to clients and have them make their own countdown based on this. But, you can make it very simple with just an IntValue or StringValue and use val.Changed for your update function.

3 Likes

Interesting. I haven’t heard of many reasons why you wouldn’t want to do that, and even in my own games I’ve had times where I found it easier to simply clone the UI to the client after populating it on the server side. Why would it not be optimal?

Here’s an example:
in the Server Script Service:

local RoundGui = game:GetService("ReplicatedStorage").StringValue --Whatever the name is
local IntermissionTime = 20
while wait(1) do
RoundGui.Value = "Intermission: "..IntermissionTime.." Seconds"
IntermissionTime = IntermissionTime - 1
end

and in the text label itself:

local value = game:GetService("ReplicatedStorage").StringValue --Whatever the name is
script.Parent.Text = value.Value
value:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = value.Value
end)
1 Like

There are over 20 reasons but I will be general and explain the most important ones:

  1. The server has extra load now that it has to be constantly manipulating people’s GUIs for no reason, when they could just be doing it themselves instead, especially if it is busy trying to make 200 people’s coins spin or something equally as useless
  2. GUIs are usually almost always only client-sided, meaning the server wouldn’t and shouldn’t be able to access them directly or even be able to interact with them
  3. The client’s GUI is on their computer, so if they’re the one manipulating it, it will always look far cleaner than if the server were to try and animate it themselves and replicate it over the network
  4. The server is completely incapable of listening to any GUI events, including those in SurfaceGuis and BillboardGuis, as GUI interaction is handled only client-side
  5. It is really bad practice. You want all visuals to be handled client-side. And, if using OOP, you will not be able to share your custom classes for your GUI across remote events and such, thus, you should use the server to initiate, verify, confirm, and communicate interactions and conversations. The server doesn’t need to care (at all) about what’s happening in the GUI, as long as the correct information is being relayed.
  6. Communication should be achieved by having conversations between the client and server, sending only what is necessary, and not by manipulating the client’s screen directly.
    …
3 Likes

There’s different ways to accomplish this but here’s some things to keep in mind

  1. The server will have to know how much time Intermission has left for obvious reasons.
  2. Players that join during Intermission should also be given the gui.

Fair enough. I guess offsetting server load is better in most cases for all players.

Going back on topic, @SadWowow21, if you’re interested in learning more about how a server-wide countdown can be handled, you should check out this article right here. It helped me quite a bit in figuring out how to build the system.

1 Like

@LightningLion58 ‘s example is the way I would do it. Having the server set the time will keep the timer the same for all clients otherwise individual clients will become out of step.

1 Like