Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with Hint's text changing?

Asked by
FiredDusk 1466 Moderation Voter
7 years ago

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

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

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

Ad

Answer this question