local counter = 100 while(counter <= 100) do counter = counter - 1 print(counter) game.StarterGui.ScreenGui.countdown.Text = ("Countdown =" .. counter) wait(1) end
I am trying to have a textlabel displaying the countdown, and print it into the output as well. (I do have a textlabel in a ScreenGUI in Starter GUI named "countdown", so that is not the issue) the text label pops up, and it says "countdown = 99)
I found the problem (like the other people answering this question), and it's because you're trying to manipulate the text label inside the StarterGui. This wont work, as StarterGui is basically a service that clones anything within it into the player's PlayerGui. However, this is a pretty easy fix.
local Counter = 100 while (Counter <= 100) do Counter = Counter - 1 script.Parent.countdown.Text = "Countdown = "..counter end
This is the code except that it's slightly cleaner, and it's getting the countdown label. Make sure it's a local script located within the ScreenGui. For getting the countdown label I get the parent of the script (since it's probably in the screengui) and then I find the countdown label and manipulate the text to concatenate "Countdown = " and the value of the variable we declared previously, counter.
Use local scripts, or if you're using scripts, make sure the Parent of that script is 'textlabel'
Hope this works! lol
Your issue is you're referencing the games StarterGui, which acts as a placeholder for all your UI's.
However the items in this folder, will NOT show up on the players screen, unless they reset. This is because the players each have their own UI Folder, called "PlayerGui", which is where any items in the global StarterGui get cloned and put into.
So just tweak your code a bit and you should be fine :).