Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I use the Interpolate method?

I've been experimenting with Interpolate, the method that allows scripters to move the camera smoothly from one position to another. Unfortunately, whenever I try to use this to move the camera smoothly through a model full of bricks, my screen turns white and I can see nothing.

The model of bricks in which I want the camera to move through has hierarchy like this:

Model
	1
	2
	3
	4	
	(etc.)

with the numbers being parts. Here is the code that I'm using, slightly modified for clarity's sake. Please assume all undefined variables are properly defined and equal to the instance they are named for. (Because they are correct, I've checked...)

for i = 1, #model:GetChildren() do
	camera:Interpolate(model[tostring(i)].CFrame, model[tostring(i)].CFrame, 3)
	wait(3)
end

What this should do is smoothly tween the camera to the next brick in the model (which is defined) every three seconds. Since each brick's name is a number, model[tostring(i)] is correct. Each time the camera moves, it should be looking at the next part in the sequence because of the second argument I gave Interpolate(). Unfortunately, everything simply turns white.

-This is a Local Script

-Variables are defined properly

-The code does not run immediately when the game starts, so I'm fully loaded.

-No errors are shown in the output and no warnings are in Script Analysis.

2 comments

0

Why was this downvoted? It's a perfectly good question and follows all the guidelines given in the "How to post good questions and answers" page.

1

@Perci1, I know right. Some of these excessive and unreasonable downvotes should be monitored.

1 answer

✓ Accepted answer

The reason the screen turns white is because you're setting the Focus and the CoordinateFrame of the Camera as the same CFrame. If you do so, you'll get a white screen. In order to fix it, set the focus to at least 1 stud away from the brick that CoordinateFrame is set to. Like so:

for _,Obj in pairs(model:GetChildren()) do
	camera:Interpolate(Obj.CFrame, Obj.CFrame + Obj.CFrame.lookVector, 3)
	wait(3)
end

Hope this helped!

1 comment

0

Thanks a ton.

This discussion is preserved as it was. New answers, comments, and votes are closed.