Having a bug for my lerp animation sequence

so i have a script that lerps camera cframes and i have a function where i can switch certian views and it works but this specific lines of code that wont activate the first line no matter where i put it but code without the wait works perfectly fine.

what im trying to acheave is that at the five seconds it changes to that cframe but it seems to make the first line make it not work but after the wait it goes to that first. im unsure whats wrong with it.
when i remove the wait and the code after wait it works and i swopped if its the part but it was not so.

if Selected == 1 then -- this is true
		if s1 == false then -- this is false so it will go through
			if AnimationPlaying == false then -- this is also false so it will go through
					s1 = true -- this toggles it so that in RenderStepped it will go through once until it is done
	
	Goal = CameraLocations.Panning.CFrame
	panspeed = 0.001
	FOVGOAL = 35
	FOVSPEED = 0.25
	
wait(5)
	
	Goal = CameraLocations.Panning_area1.CFrame 
	panspeed = 0.001
	FOVGOAL = 50
	FOVSPEED = 0.5
	s1 = false
			end	

	end
	end

so far i have no solution for this because it would just skip over what i want it to do.

Would you please put some prints in and show us the results.
Specifically the values of variables set before the code snippet you have shown us.

This is a snippet of the rest of the code, i have alot of other code but this is what this uses with

game:GetService('RunService').Stepped:Connect(function()
	
Selected = script:WaitForChild("Value").Value
Selected = script.Value.Value

s1 = false
	s2 = false
	s3 = false
	s4 = false
	s5 = false

if s1 == true or s2 == true or s3 == true or s4 == true or s5 == true then
		
		
		AnimationPlaying = true
	end

if Selected == 1 then
		if s1 == false then
			if AnimationPlaying == false then
					s1 = true
	
	Goal = CameraLocations.Panning.CFrame
	panspeed = 0.001
	FOVGOAL = 35
	FOVSPEED = 0.25
	print("Step1")
wait(5)
	
	Goal = CameraLocations.Panning_area1.CFrame 
	panspeed = 0.001
	FOVGOAL = 50
	FOVSPEED = 0.5
	s1 = false
			
			print("Step2")
	
			end	
		end
	end
end)

this is my output when beginning animation


then when that wait is over then this happens and i am unsure why its behavior is this when i wanted it to activate all of them once at a time.

is this user error or is this normal with what i have.

Could you add a print of Selected so we know the value.
The top screenshot shows the end of an error message can you show us that please.

There isn’t a error message and I’m unsure what you mean of “add a print of selected” are you saying I should add a print at the statement where the if selected then spot. Because it works perfectly with all of my other ones that don’t have wait() so I’m unsure what your trying. It would most likely be activating like a if statement in a renderstep. Like it’s layed out I put on the above comment. When I get the time I’ll add print to selected when I get the time tho.

Also in the pictures with output it shows what the the value on the right and is 1.

I control it manually and the other functions with the same if statements work. Which led to me think that something is wrong on how I’m approaching it but idk.

Like all puzzles it helps if your have all the bits.
I wanted to know what the value was of the variable Selected as the logic steps taken are dependant on it.
I am trying to help by asking you to do what I would if I had the same setup.

Ah I see I’ll do that when I get to my computer. Also you replied before I edited might want to reread the reply.

Btw is the code sloppy to you some people think my code is sloppy looking. I try to space them out to be more readable.

Ok. Thanks for highlighting the problem with me not seeing the value in the picture.
I was not able to see what the GarageCamController was but by deduction its the script and it has the child called Value whose Value is assigned to the variable Selected.
I mentioned the error as there is a line in blue at the bottom of the picture in the output section that mentions a time and Stack End.
That to me implies there was an error message above that in the output.
My further question is what happens if you change the value in the Value?
And finally can you adjust the print(“Step1”) to print(“Step1”,s1).
Do another run please and let me know the results.

To answer the question in what the error is. It’s not from the script it’s from a vehicle script inside it’s viewport wich I still need to remove. When I test I will try to remove those scripts.

So pretty much when I change selected it interrupts and changes the location immediately. I’ll put print values in every step of the process.

Not I will try and use your format for it.

print(“step1”,s1)

Garage cam is the script.

I recorded a video to see if it would help.
Dev forum won’t let me upload it so it’s in a google drive link.

I also put print() in each step also

That freeze was from me downloading stuff in background.