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

Help with Hint's text changing?

Learning how to use function properly but having trouble :( I get no error but the Hint text does not change nor show.

local Hint = Instance.new("Hint", game.Workspace)

function GetIntermission()
	for i = 10,0 do
		Hint.Text = "Intermission" ..i
		wait(1)
	end
end

--//GAME
while wait() do
	GetIntermission()
	
end

1 answer

✓ Accepted answer

You forgot to tell the script to count backwards.

In a for loop, if you wish for it to count backwards you simply add another value to tell it to do so, without this added value the script will not run because it is being told to count upwards from 10 to 0 which is not possible.

local Hint = Instance.new("Hint", game.Workspace)

function GetIntermission()
    for i = 10,0, -1 do -- Define the negative value which will make the loop count backwards.
        Hint.Text = "Intermission" ..i
        wait(1)
    end
end

--//GAME
while wait() do
    GetIntermission()

end

See also: http://wiki.roblox.com/index.php?title=Loops#For

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