Help With Camera Manipulation

Basically, I want an epic fighting scene with camera movement and everything!

The problem is I keep getting an error message “infinite yield possible for (myObjectName)”

I’ve tried AI, DevForum, Videos, and nothing.

The only thing I suspect that could be causing the issue, the actual camera part is pretty far away from spawn. But I tested with a different script. Something like lua local Camera = workspace:WaitForChild("CameraPart", 5) if Camera then print("Found!") else print("Not Found.") end

Here is the script! (Sorry for the silly camera names!)

local Cam1 = workspace:WaitForChild("CamOCamO1", 50)
local Cam = workspace.Camera
local Cam2 = workspace:WaitForChild("CamOCamO2", 50)
local Cam3 = workspace:WaitForChild("Cam0Cam03", 50)
local Cam4 = workspace:WaitForChild("Cam0Cam04", 50)
local Cam5 = workspace:WaitForChild("Cam0Cam05", 50)
local PV = workspace:WaitForChild("PillarView")
local TI = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local TS = game:GetService("TweenService")

PV:GetPropertyChangedSignal("Value"):Connect(function()
	if PV.Value == 1 then
	Cam.CameraType = Enum.CameraType.Scriptable
	Cam.CFrame = Cam1.CFrame
	TS:Create(Cam, TI, {CFrame = Cam2.CFrame}):Play()
	task.wait(5)
	Cam.CameraType = Enum.CameraType.Custom
	task.wait(18.5)
	Cam.CameraType = Enum.CameraType.Scriptable
	Cam.CFrame = Cam3.CFrame
	end
end)

well, that “infinite yield possible" notice occurs because it can’t find anything with the name you’re searching for, and it happens for one of two reasons

  1. you spelled the name of what you’re looking for wrong
  2. the thing you’re looking for doesn’t exist

in the case of scenario 1, it seems that you used uppercase letter "O"s instead of the number “0” in your first couple WaitForChilds, which might be a typo

in the case of scenario 2, there could be any number of reasons, such as

  • your game has StreamingEnabled and the camera objects aren’t being streamed
  • the desired object’s name is spelled wrong (and can’t be found)
  • something is deleting the object before it can get found

if you’ve still no luck, debug stuff and find out whats going on. probably something game-environment related

1 Like

But if I use the autofill feature in roblox studio, wouldnt it not be misspelled? Also the O’s and 0’s were a mistake but I knew this but I actually correctly typed the names of the camera name because of the autospell.

if you looked you would’ve already found that there is solutions to the issue.

Also don’t bother using Ai. Ai wont know roblox custom types or anything about Roblox’s engine in its current state 99% of the time and it also just keeps you in your comfort zone. That’s thing I miss about pre-ai “coding”.


Now like the person before me has said the reason why you get infinite yield is because the target does not exist in its current context at the current point in time so it will forever keep waiting for said child to appear.

Literally everyone will tell you the exact same thing. You need to ensure the script is able to access and find said instance and its parent(s). Meaning make sure it exists dude.

Before me’s reply:

Why would it be misspelt? Its called autofill for a reason hence why it auto fills the targeted instances name. It will only ever be misspelt if you misspelt it.

Not that it would help, but you should use workspace.CurrentCamera instead of workspace.Camera

Could you at least link where i could have found the infinite yield solve?

But how do I make it appear to the script?! The object is there, and I can even select it, autofill it, ect. If anything I could fix the O’s and 0’s.

But again, like I suspected, mabye the part is just too far away from spawn. (Which I dont want to move since its a pillar you need to teleport to.)