Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't the text change?

I cannot get the text to change. The script is enabled. The output is showing no errors.

This is the script:

--tber8--

local output = game.Workspace.Output.Screen.SurfaceGui.Frame.TextLabel.Text --local

--Configurations--
local RoundLength = 120 --Round time in seconds.
local IntermissionLength = 30 --Intermission time in seconds.

while true do
	repeat
		wait()
	until game.Players

    --Intermission--
    for i = IntermissionLength,0,-1 do -- This says from 20 to 0 by going down1 every..
        wait(1)
        output = 'Starting in ' ..i --Make the text stay the same but changes just the number.
    end

    output = "Game Beginning"
    wait(10)
end

2 answers

✓ Accepted answer

That script will not work as your variable cannot be a property. I removed .Text from the output variable and used .Text after output to display it. The script should now work.

What you did is create a variable with the string "TextLabel"(Default text).

Changing that variable will not do anything...



local output = game.Workspace.Part.SurfaceGui.TextLabel.Text --local
--That's the same thing as 
local output="TextLabel"

print(output)
output="Swag"
print(output)

--tber8--

--Removed .Text
local output = game.Workspace.Output.Screen.SurfaceGui.Frame.TextLabel 

--Configurations--
local RoundLength = 120 --Round time in seconds.
local IntermissionLength = 30 --Intermission time in seconds.

while true do
    repeat
        wait()
    until game.Players

    --Intermission--
    for i = IntermissionLength,0,-1 do -- This says from 20 to 0 by going down1 every..
        wait(1)
        output.Text = 'Starting in ' ..i --Make the text stay the same but changes just the number.
    end

    output.Text = "Game Beginning"
    wait(10)
end

When you create the output variable, you record the object's Text property's value. The variable doesn't change when the object's Text value changes, and vice versa.

In order to make it work, you only need to make the output variable point to the object, and change output.Text rather than output:

--tber8--

local output = game.Workspace.Output.Screen.SurfaceGui.Frame.TextLabel --local

--Configurations--
local RoundLength = 120 --Round time in seconds.
local IntermissionLength = 30 --Intermission time in seconds.

while true do
    repeat
        wait()
    until game.Players

    --Intermission--
    for i = IntermissionLength,0,-1 do -- This says from 20 to 0 by going down1 every..
        wait(1)
        output.Text = 'Starting in ' ..i --Make the text stay the same but changes just the number.
    end

    output.Text = "Game Beginning"
    wait(10)
end

Hope this helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.