Camera is Not Updating With Welded Movement

I am creating a solar system, and I when you click a button it takes you to a certain planet. The planet is unanchored, and welded to the sun, because it is spinning on a cylindrical constraint. The camera is welded to the planet, which moves around the sun just like the planet. But if I update the player’s camera to the planet’s camera. It does not move with the planet.

I have tried updating it every second (updating the camera CFrame) but it does not work.

like this:

while true do
camera.CFrame = CF:WaitForChild("c2").CFrame
wait()
end

however, this makes it really laggy.

Is there anyway I could fix this isue?

Thanks, cal.

Have you tried using RenderStepped instead of a while true do loop?

-- Wait for the player to load to avoid errors
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Hum = Character:WaitForChild('Humanoid')

-- This is all we need
local RunService = game:GetService('RunService')
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
-- CameraPart is the part in workspace that your camera is going to snap to
-- Change this to change the camera.
-- Example: CameraPart = workspace.Planet1.Camera
local CameraPart = workspace.CameraPart

-- Optional
local TweenService = game:GetService('TweenService')
local CameraTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)

RunService.RenderStepped:Connect(function()
	Camera.CFrame = CameraPart.CFrame
	
	-- You could use tweenservice, to make the movement of the camera smooth if the movement is still jittery
	-- TweenService:Create(Camera, CameraTweenInfo, {["CFrame"] = CameraPart.CFrame}):Play()
end)
1 Like

Thank you so much! This works very well!