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

How to make a for i loop that loops trough cameraparts in workspace?

local Camera = workspace.CurrentCamera

--// CameraParts
local Cameras = workspace:WaitForChild("Cameras")
    local CurrentCameraPart = 1
    local CurrentCameraText = "CameraPart"
	local CurrentCameraCombined = (CurrentCameraText..CurrentCameraPart)
	local NextCurrentCamera = 2
	local NextCurrentCameraText = "CameraPart"
	local NextCurrentCameraCombined = (NextCurrentCameraText..NextCurrentCamera)

--// Camera Setter	
repeat wait(1) 
Camera.CameraType = Enum.CameraType.Scriptable
until
Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = CurrentCameraCombined.CFrame

--// Lerping
for Num = 0,1,.01 do
	Camera.CFrame = CurrentCameraCombined.CFrame:lerp(NextCurrentCameraCombined.CFrame,Num)
	game:GetService("RunService").RenderStepped:Wait()
	NextCurrentCameraCombined = NextCurrentCameraCombined + 1
	CurrentCameraCombined = CurrentCameraCombined + 1
end

I tried making Lerp script for my cameras but i forgot how i can do this easy can somebody help me?

3 comments

0

What are you trying to accomplish?

0

Yeah, I'm also confused on what your motive is.

0

to lerp camameras

1 answer

tried to fix the issue myself came up with this does not work

local Camera = workspace.CurrentCamera

--// CameraParts
local Cameras = workspace:WaitForChild("Cameras")
    local CurrentCameraPart = 1
    local NextCurrentCamera = 2
    local workspaceCameraFolder = workspace.Cameras
    local CurrentCamera = (workspaceCameraFolder.CameraPart+CurrentCameraPart)
	local NextCamera = (workspaceCameraFolder.CameraPart+NextCurrentCamera)

--// Camera Setter	
repeat wait(1) 
Camera.CameraType = Enum.CameraType.Scriptable
until
Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.Cameras.CameraPart1

--// Lerping
for Num = 0,1,.01 do
	Camera.CFrame = CurrentCamera.CFrame:lerp(NextCamera.CFrame,Num)
	game:GetService("RunService").RenderStepped:Wait()
	CurrentCameraPart = CurrentCameraPart + 1
	NextCurrentCamera = NextCurrentCamera + 1
end

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