I’m making a main menu system for a commission, but for some reason the camera keeps snapping back to the character and resuming the tween.
Code:
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local TweenService = game:GetService("TweenService")
local Camera = workspace.CurrentCamera
local CameraParts = ReplicatedFirst:WaitForChild("CameraParts"):GetChildren()
local StarterMenu = script.Parent
local CameraCycleEnabled = true
local currentTween
local CFramePoints = {}
for index, part in ipairs(CameraParts) do
CFramePoints[index] = part.CFrame
end
local function CameraCycle()
Camera.CameraType = Enum.CameraType.Scriptable
while CameraCycleEnabled do
Camera.CFrame = CFramePoints[1]
for i = 2, #CFramePoints do
local cframe = CFramePoints[i]
local tweeninfo = TweenInfo.new(5, Enum.EasingStyle.Linear)
local tween = TweenService:Create(Camera, tweeninfo, {CFrame = cframe})
tween:Play()
currentTween = tween
tween.Completed:Wait()
if not CameraCycleEnabled then break end
end
task.wait()
end
end
task.spawn(CameraCycle)