I made code for a shop that would manipulate the camera, and when going from the shop back to the normal camera, it is always extremely delayed, even after I increase how long the loading screen time is. It’s also inconsistent, where sometimes it takes longer than other times.
Here is the code for the shop camera
function shopCamToggle()
if shopCamEnabled == false then
shopCamEnabled = true
changeCam = false
Camera.CameraType = "Scriptable"
Camera.Changed:Connect(function()
if Camera.CameraType ~= "Scriptable" and changeCam == false then
Camera.CameraType = "Scriptable"
end
end)
Camera.CFrame = shopCam.CFrame
Camera.FieldOfView = 80
camTiltRight = TweenService:Create(Camera, titleInfo, {CFrame = Camera.CFrame * CFrame.Angles(0,0,math.rad(1))})
camTiltLeft = TweenService:Create(Camera, titleInfo, {CFrame = Camera.CFrame * CFrame.Angles(0,0,math.rad(-1))})
camCoroutine = coroutine.create(function()
while true do
camTiltRight:Play()
camTiltRight.Completed:Wait()
camTiltLeft:Play()
camTiltLeft.Completed:Wait()
end
end)
coroutine.resume(camCoroutine)
else
changeCam = true
Camera.CameraType = "Custom"
Camera.FieldOfView = 100
shopCamEnabled = false
coroutine.close(camCoroutine)
end
end