Script doesn't resume after function

Hello I seem to have a problem with functions

ChoiceOne.Activated:Connect(function()
	module.Fade(ChoiceOne, ChoiceTwo, ChoiceThree, ChoiceFour)
	Camera.CFrame = StudentCameraTwo.CFrame
	AnaTalk:Play()
	Subtitles.Text = "Ana: Yeah I have a question"
	wait(4)
	Choices.Visible = false
	AnaTalk:Stop()
	Camera.CFrame = TeacherCameraTwo.CFrame
	AnitaTalk:Play()
	Subtitles.Text = "Teacher: Don't shout out, Ana I've told you this already."
	wait(5)
	AnitaTalk:Stop()
	ChoicesTwo.Visible = true
end)

After the module.Fade part the script doesn’t work (yes this is a local script) Can anyone help me with this issue, also the function works fine. Just after it that doesn’t

Show the code of module.Fade please.

Ok here

local module = {}
function module.FadeChoosen(Button)
	while true do
		wait(0.07)
		Button.BackgroundTransparency = Button.BackgroundTransparency + 0.1
		Button.TextTransparency = Button.TextTransparency  + 0.1
		if Button.BackgroundTransparency == 1 and Button.TextTransparency >= 1 then
			break
		end
	end
end

function module.Choose(Button)
	Button.UIStroke.Enabled = true
	while true do
		wait(0.06)
		if Button.BackgroundTransparency <= 0  then
			wait(1.7)
			Button.UIStroke.Enabled = false
			module.FadeChoosen(Button)
			break
		else 
			Button.BackgroundTransparency = Button.BackgroundTransparency - 0.1
		end
	end

end


function module.Fade(Button, ButtonTwo, ButtonThree, ButtonFour)
	while true do
		wait(0.07)
		ButtonTwo.BackgroundTransparency = ButtonTwo.BackgroundTransparency + 0.1
		ButtonTwo.TextTransparency = ButtonTwo.TextTransparency  + 0.1
		ButtonThree.BackgroundTransparency = ButtonThree.BackgroundTransparency + 0.1
		ButtonThree.TextTransparency = ButtonThree.TextTransparency  + 0.1
		ButtonFour.BackgroundTransparency = ButtonFour.BackgroundTransparency + 0.1
		ButtonFour.TextTransparency = ButtonFour.TextTransparency  + 0.1
		if ButtonTwo.BackgroundTransparency >= 0.95 and ButtonTwo.TextTransparency >= 1 then
			module.Choose(Button)
			Button.Parent.Visible = false
			break
		end
	end
end

return module

I assume it gets stuck in your while true do loops, why not just set the module up to use TweenService?

I thought so to, but everything works.

How would I use tween service with this?

Give me a couple minutes to go edit this code in studio. I don’t have your GUI though, so I can’t test it fully.

Also, what was the logic behind having the 3 seperate functions if calling one calls another, which calls another?

Because if I put one function under another it wouldn’t fire so I improvised.

here’s the UI: ChoicesOne - Roblox

Okay, when testing, I just added a print into each while loop. It gets stuck in “FadeChoosen” and just keeps going. Meaning it probably went past your catch value for the transparency. Working on making it use TweenService now

Oh I see it now thank you very much!

This is how it turned out need to fix a few animation bugs but:
robloxapp-20210825-2002407.wmv (1.7 MB)

Left your old code in there so you could see how much this shaved off there.

local TWEEN_TIME = 1;

local tweenService = game:GetService("TweenService");
local tweenInfo = TweenInfo.new(TWEEN_TIME, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut);

local module = {}

function module.Fade(Button, ...)
	for _, button in pairs({...}) do
		local buttonTween = tweenService:Create(button, tweenInfo, {
			BackgroundTransparency = 1;
			TextTransparency = 1;
		});
		buttonTween:Play();
	end;
	task.wait(TWEEN_TIME);
	
	Button.UIStroke.Enabled = true;
	
	local tween = tweenService:Create(Button, tweenInfo, {
		BackgroundTransparency = 0;
	});
	tween:Play();
	tween.Completed:Wait();
	Button.UIStroke.Enabled = false;
	
	task.wait(1.7);
	
	tween = tweenService:Create(Button, tweenInfo, {
		BackgroundTransparency = 1;
		TextTransparency = 1;
	});
	tween:Play();
	tween.Completed:Wait();
	
	Button.Parent.Visible = false;
	
	--while true do
	--	print("fade")
	--	wait(0.07)
	--	ButtonTwo.BackgroundTransparency = ButtonTwo.BackgroundTransparency + 0.1
	--	ButtonTwo.TextTransparency = ButtonTwo.TextTransparency  + 0.1
	--	ButtonThree.BackgroundTransparency = ButtonThree.BackgroundTransparency + 0.1
	--	ButtonThree.TextTransparency = ButtonThree.TextTransparency  + 0.1
	--	ButtonFour.BackgroundTransparency = ButtonFour.BackgroundTransparency + 0.1
	--	ButtonFour.TextTransparency = ButtonFour.TextTransparency  + 0.1
	--	if ButtonTwo.BackgroundTransparency >= 0.95 and ButtonTwo.TextTransparency >= 1 then

	--		Button.UIStroke.Enabled = true
	--		while true do
	--			print("choose")
	--			wait(0.06)
	--			if Button.BackgroundTransparency <= 0  then
	--				wait(1.7)
	--				Button.UIStroke.Enabled = false

	--				while true do
	--					print("FadeChoosen")
	--					wait(0.07)
	--					Button.BackgroundTransparency = Button.BackgroundTransparency + 0.1
	--					Button.TextTransparency = Button.TextTransparency  + 0.1
	--					if Button.BackgroundTransparency == 1 and Button.TextTransparency >= 1 then
	--						break
	--					end
	--				end

	--				break
	--			else 
	--				Button.BackgroundTransparency = Button.BackgroundTransparency - 0.1
	--			end
	--		end

	--		Button.Parent.Visible = false
	--		break
	--	end
	--end
end

return module