Basically, I’m attempting to make a menu scene with tweening cameras. When I test it in studio, it only works half the time and now its stopped working in studio but when I play the game on roblox normally it works. (Not a problem with publishing etc, the game is the same as whats in studio). The folder does exist in the workspace.
I constantly get this in the output:
MenuCams folder is missing or empty! - Client - CinematicPlayer:12
I’m not the smartest when it comes to scripting, but I’m trying.
Script
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local Lighting = game.Lighting
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
local folder = workspace:FindFirstChild("MenuCams")
if not folder or #folder:GetChildren() == 0 then
warn("MenuCams folder is missing or empty!")
return
end
local parts = folder:GetChildren()
table.sort(parts, function(a, b)
return tonumber(a.Name) < tonumber(b.Name)
end)
local initialCamera = folder:FindFirstChild("6")
if initialCamera then
Camera.CFrame = initialCamera.CFrame
else
warn("Camera 6 not found in MenuCams!")
return
end
Lighting.ClockTime = 3.9
for i = 6, 1, -1 do
local targetPart = folder:FindFirstChild(tostring(i))
if targetPart and targetPart:IsA("BasePart") then
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
local tween = TweenService:Create(Camera, tweenInfo, {CFrame = targetPart.CFrame})
tween:Play()
tween.Completed:Wait()
else
warn("Camera " .. i .. " is missing or invalid. Skipping.")
end
end
-- Set final camera to MouseCam and enable parallax effect
local mouseCam = workspace.MenuArea:FindFirstChild("MouseCam")
if not mouseCam then
warn("MouseCam not found in MenuArea!")
return
end
Camera.CFrame = mouseCam.CFrame
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local parallaxStrength = 1
mouse.Move:Connect(function()
local offsetX = mouse.X / Camera.ViewportSize.X
local offsetY = mouse.Y / Camera.ViewportSize.Y
local newCFrame = mouseCam.CFrame:ToWorldSpace(
CFrame.new(offsetX * parallaxStrength, offsetY * parallaxStrength, 0)
)
Camera.CFrame = newCFrame
end)
local mainMenu = player.PlayerGui.MenuGui.Frame.ButtonHolder
local targetPosition = UDim2.new(0.333, 0, 0.656, 0)
local menuTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local menuTween = TweenService:Create(mainMenu, menuTweenInfo, {Position = targetPosition})
menuTween:Play()
Any help is welcome!