Tweening problem

I am doing this commission where I am making a therapy center and when you join it’s not supposed to spawn your character and you get to choose a team with a camera tween in the background but it’s not working. Instead what happens is that the UI turns invisible and the camera doesn’t move and it looks like this .


Here is a screenshot of my workspace.
Screen Shot 2021-06-07 at 2.41.12 PM

Here is a screenshot of the “Teams” service.
Screen Shot 2021-06-07 at 2.53.32 PM
Here is a screenshot of my (server-side) script and remote function
Screen Shot 2021-06-07 at 2.41.28 PM
And finally here is a screenshot of my UI.
Bug
Here is the code for the “Main” local script (third screenshot).
local menu = script.Parent.Menu

local welcome = script.Parent.Welcome

local therapist = menu.Therapist
local patient = menu.Patient

local camera = workspace.CurrentCamera

local initialPoint = workspace.CameraPoints:WaitForChild("InitialPoint")

local point2 = workspace.CameraPoints:WaitForChild("Point2")

local teamChosen = game.ReplicatedStorage.teamChosen

function tween()
	local tweenService = game:GetService("TweenService")
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = initialPoint.CFrame
	camera.Focus = point2.CFrame
	local tweenInfo = TweenInfo.new(
		20,
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.Out,
		0,
		false,
		0
	)
	local myTween = tweenService:Create(camera,tweenInfo,{CFrame = point2.CFrame})
	myTween:Play()
	print("Tweened Played")
end

tween()

wait(10)

therapist.MouseButton1Click:Connect(function()
	teamChosen:FireServer("Therapist")
	camera.CameraType = "Custom"
	menu.Visible = false
	welcome.Visible = false
	
end)

patient.MouseButton1Click:Connect(function()
	teamChosen:FireServer("Patient")
	camera.CameraType = "Custom"
	menu.Visible = false
	welcome.Visible = false
end)

Finally here is the code for the “onTeamChosen” script.

local teamChosen = game.ReplicatedStorage.teamChosen

teamChosen.OnServerInvoke = function(player,team)
	print("Invoked")
	local selectedTeam = game:GetService("Teams"):FindFirstChild(team)
	player.Team = selectedTeam
	player:LoadCharacter()
	return
end

A thought about what the problem could be with…

I think it might have something to do with returning in the (server side) onTeamChosen script.

Does anything print for any of it? If not could you put some more prints in the scripts so we can focus on the issue? Do you have the GUI enabled/visible?

The onTeamChosen script shouldn’t be the issue since it won’t fire until the button has been pressed.

On a side note you shouldn’t use a remote function unless you’re returning something, so in this case use a remote event. You also don’t need to put the tween in a function. You should take that entire block out of the function and just use Tween:Play() when you want it to play, instead of calling a function which does the same thing.

That is a good idea, and I’m using a remote function so that client knows that their requested to join a team has been “approved” because remote functions yield.

But I might make it a little different as well.