Lobby teleportation camera transition not working

I’m trying to make a transition for the player’s Current camera. So, to complete this, I placed a part that it will be touched by a player, then, the camera changes its position looking at a TV security camera monitor in the wall, the security camera sees the player inside the teleporter.

The issue is that the camera is not moving, same with the part. The part is anchored and CanCollide is disabled. I made all of the transition using a client script.

I tried using Current-camera tween service in a script, but the script had lots of errors that it was hard debugging them.

I have some screenshots of what i currently have in my workspace and scripting

Part script:

local detectpart = script.Parent
local endpos = {69.385, 7.364, 131.753}
local endori = {41.994, 90.832, 0}
local startpos = workspace.Camera.Focus.Position
local cam = workspace.Camera
local rs = game:GetService("RunService")
local tweenservice = game:GetService("TweenService")

detectpart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if hit.Parent.Humanoid.Health > 0 then
			local goal = {}
			goal.Position = endpos
			goal.Orientation = endori
			local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
			local tween = tweenservice:Create(cam, tweeninfo, goal)
			tween:Play()
			wait(1)
			cam.CameraType = Enum.CameraType.Scriptable
			cam.CFrame = CFrame.new(endpos) * CFrame.fromEulerAnglesXYZ(endori[1], endori[2], endori[3])
			wait(1)
			rs.RenderStepped:Connect(function()
				cam.CFrame = CFrame.new(endpos) * CFrame.fromEulerAnglesXYZ(endori[1], endori[2], endori[3])
			end)
		end
	end
end)

Screenshots/videos:

Screenshot 2024-04-15 134959
Screenshot 2024-04-15 134920

1 Like