Camera changing only for a second or half

I’m trying to fix my chest system but for some reason this happens.
https://gyazo.com/13ec3a624f105817756e958c9a2396af
As you can see, it sets the camera to the chest for half a second.

Chest Opening Module
local functions = {}
local lootmod = require(script.Loot)
local items = game.ServerStorage.Item	
local store = game.ReplicatedStorage.Store
local tweeninfo = TweenInfo.new(0.25, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
local ts = game:GetService("TweenService")
local cam = game.ReplicatedStorage.RemoteEvents.Camera

function destroy(chest)
	
	for i, v in pairs(chest:GetChildren()) do
		if v:IsA("MeshPart") or v:IsA("BasePart") then
		    local twin1 = ts:Create(v, tweeninfo, {Size = Vector3.new(0, 0, 0)})
			local twin = ts:Create(v, tweeninfo, {Transparency = 1})
		    twin1:Play()
			twin:Play()
			twin.Completed:Connect(function()
				for i, kk in pairs(chest:WaitForChild("RootPart"):GetChildren()) do
					if kk:IsA("ParticleEmitter") then
						if kk.Name == "Explode" then
							kk:Emit(kk:GetAttribute("EmitCount") * 2)
						end
					end
				end
				wait(0.5)
				chest:Destroy()
			end)
		end
	end
	
end

function getLoot(loottable)
	local sum = 0
	for i, chance in pairs(lootmod.loot(loottable)) do
		sum += chance
	end
	local random = math.random(sum)
	for i, chance in pairs(lootmod.loot(loottable)) do
		if random <= chance then
			return i
		else
			random -= chance
		end
	end
end

function functions.Get(plr, Chest, anim, controller, chesttype)
	local track = controller:LoadAnimation(anim)

	for i, v in pairs(Chest:WaitForChild("RootPart"):GetChildren()) do
		if v:IsA("ParticleEmitter") then
			if v.Name == "Glow" then
				v.Enabled = true
			end
		end
	end
	
	cam:FireClient(plr, Chest:WaitForChild("RootPart").ChestPrompt, 5) -- THIS IS THE FIRECLIENT PART
	track:Play()
	
	track:GetMarkerReachedSignal("Open"):Connect(function()
		
		for i, v in pairs(Chest:WaitForChild("RootPart"):GetChildren()) do
			if v:IsA("ParticleEmitter") then
				if v.Name == "Glow" then
					v.Enabled = false
				end
			end
		end
		
		local resultLoot = getLoot(chesttype)
		if typeof(resultLoot) == "string" then
			for i, k in pairs(items:GetDescendants()) do
				if k.Name == resultLoot then
					if k.Parent:IsA("Folder") then
						
						if k.Parent.Name == "Fruit" and k.Parent:IsA("Folder") then
							local clone = k:Clone()
							clone.Parent = plr.Backpack
							local clone2 = store:Clone()
							clone2.Parent = clone
							print("plr got" .. k.Name .. "lol")
							wait(1)
							track:Stop()
							destroy(Chest)
						elseif k.Parent.Name == "Weapons" and k.Parent:IsA("Folder") then
							local clone = k:Clone()
							clone.Parent = plr.Backpack
							print("plr got" .. k.Name .. "lol")
							wait(1)
							track:Stop()
							destroy(Chest)
						end

					end
				end
			end
		elseif typeof(resultLoot) == "number" then
			plr.Data.Beli.Value += resultLoot
			track:Stop()
			print("Plr got money: " .. resultLoot)
			destroy(Chest)
		end
		
	end)

end

return functions
LocalScript that has the OnClientEvent thingy
local rs = game:GetService("ReplicatedStorage")
local res = rs.RemoteEvents
local camevent = res.Camera
local camera = workspace.CurrentCamera
local O_CF = camera.CFrame
local UserInputService = game:GetService("UserInputService")

camevent.OnClientEvent:Connect(function(part, timee)
	camera.CFrame = part.CFrame * CFrame.Angles(0, math.rad(180), 0) * CFrame.new(0, 0, 5)
	camera.CameraType = Enum.CameraType.Scriptable
	wait(2)
	camera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
	camera.CameraType = Enum.CameraType.Custom
end)
local rs = game:GetService("ReplicatedStorage")
local res = rs.RemoteEvents
local camevent = res.Camera
local camera = workspace.CurrentCamera
local O_CF = camera.CFrame
local UserInputService = game:GetService("UserInputService")

camevent.OnClientEvent:Connect(function(part, timee)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part.CFrame * CFrame.Angles(0, math.rad(180), 0) * CFrame.new(0, 0, 5)
	wait(2)
	camera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
	camera.CameraType = Enum.CameraType.Custom
end)

Set camera type to scriptable before scripting its CFrame property.

That didn’t fix it sadly, it still sets it for a second.

local rs = game:GetService("ReplicatedStorage")
local res = rs.RemoteEvents
local camevent = res.Camera
local camera = workspace.CurrentCamera
local O_CF = camera.CFrame
local UserInputService = game:GetService("UserInputService")

camevent.OnClientEvent:Connect(function(part, timee)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part.CFrame * CFrame.Angles(0, math.rad(180), 0) * CFrame.new(0, 0, 5)
	task.wait(2)
	camera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
	task.wait(2)
	camera.CameraType = Enum.CameraType.Custom
end)

Which part is only occurring for a second? Perhaps you need a wait after each time the CFrame is changed, also how often is this event fired?

Just once when the chest opens, there’s a proximityprompt and a script that detects if the prompt is activated and requires the module…