I've been noticing something very odd recently. Sometimes my ui won't tween. There are no errors in the game console, and when I rejoin something else won't tween or it's magically fixed! I have no idea what's causing this issue. I have checked the properties of the frames I'm tweening - they're normal.

Here is my code:

function beginWrittenResponse()
	for i=1, #writtenAnswer do
		local Answered = false
		Write.A.Text = writtenAnswer[i].A
		Write.B.Text = writtenAnswer[i].B
		Write.C.Text = writtenAnswer[i].C
		Write.D.Text = writtenAnswer[i].D
		Write.Question.Text = writtenAnswer[i].Inst
		Write.Visible = true
		Write:TweenPosition(UDim2.new(0,0,0,0), "In", "Sine", 1)
		coroutine.resume(coroutine.create(function()
            Write.Submit.MouseButton1Click:wait()
			if Write.TextBox.Text == "" then
				Write.TextBox.Text = "Please enter a valid answer!"
				wait(3)
				Write.TextBox.Text = ""
				return
			end
			Answered = true
			if writtenAnswer[i].Answer == Write.TextBox.Text then
				Score = Score + 1
			end
		end))
		repeat wait() until Answered
		Write:TweenPosition(UDim2.new(-1,0,0,0), "Out", "Sine", 1)
		wait(1)
		Write.TextBox.Text = ""
		Write.Visible = false
	end
end

Thanks in advance!

2 comments

0

It's most likely yielded at the "repeat wait() until Answered" line, try putting a print after that line and seeing if that is the problem. Also instead of doing coroutine.resume(coroutine.create(function() to run threads at the same time, just use spawn(function().

0

I added the print after "repeat wait() until Answered". It successfully prints each time. When it breaks, the UI does not tween onto the screen.