Why is this not working? Relatively simple -- no errors?


local AudioTime = game.Workspace.Sound.FranticPhoneCall.TimePosition

wait(23)

if AudioTime == 0 then

Subtitles.Visible = true

end

if AudioTime == 3 then

Subtitles.Text = "I DON'T KNOW -- SOMEWHERE AROUND THE WALKER RIVER RESERVATION --"

end```

(For some reason the variable for the subtitles did not paste – that is not the issue.)

are you sure that audiotime is incrementing?

Where would I check to see if it is/is not?

first off im going to go on a limb and guess that audiotime is a sound, and doesnt look like youve played it Which therefore increases the timeposition,

TimePosition is number of double data type. This condition will never work since the time position will never be totally equal to 3. You should always use conditions lower than (<) or greater than (>).

Yeah, sorry for not being clearer – AudioTime is a sound. It is being played in another script – and I am trying to have the position of the time monitored here, so that I can time my subtitles to the second.

Maybe trying playing the sound from the script your making the subtitles in

I would suggest making another variable which will be something like SubtitlePhase and make a condition.

if AudioTime >= 3 and SubtitlePhase < 1 then
    SubtitlePhase = 1
    Subtitles.Text = "I DON'T KNOW -- SOMEWHERE AROUND THE WALKER RIVER RESERVATION --"
end

I’ll give this a shot and get back to you. Thank you.

It’s breaking because you’re waiting past the ‘AudioTime’ of 3.

Do something along the lines of this:

local AudioTime = game.Workspace.Sound.FranticPhoneCall.TimePosition

for i = 1, 24, 1 do
	if i == 1 then
		Subtitles.Visible = true
	elseif i == 4 then
		Subtitles.Text = "I DON'T KNOW -- SOMEWHERE AROUND THE WALKER RIVER RESERVATION --"
	end

	task.wait(1)
end

Try using WaitForChild() on AudioTime instead of the 23 second wait (or on top of it whatever you want).