I like how functions pause my scripts when i don't want them to, but they don't pause my scripts when i do want them to. Anyway, i have a script below and the function im calling is supposed to return values (and it does), but the script goes on before the values are even returned. I tried adding a repeat wait() so that it wait's until the values actually exists but it still doesn't work. Please help?

local function ChangeCrewDetails() --The function im calling
	local gui = guis.crewdetails
	gui.Visible = true
	gui.Finish.MouseButton1Click:connect(function() --Since this only runs when the player clicks a button, the script goes on.
		local name = gui.NameBar.Text
		local desc = gui.Description.Text
		local decal = gui.Flag.Text
		CheckArgs(name,desc)
		gui.Visible = false
		ClearDetailScreen()
		print(name,desc,decal)
		return true,name,desc,decal
	end)
end
--....
--....Other stuff here
--....
yes.MouseButton1Down:connect(function()
		gui.Visible = false
		local bool, name, desc, decal;
		bool, name, desc, decal = ChangeCrewDetails()
		repeat wait() until bool --This will wait the script forever, without it the script goes on before the values come back.
		print("yay it worked")
		mycrew = modules.crew:InvokeServer(name,desc,decal,(game:GetService("Players").LocalPlayer),{})
		AddCrewStats()
		UpdateCrewScreen()
		ShowCrew(true)
	end)

How am i supposed to pause it?