Camera not tweening for some reason

Hey, long time no see…

Basically I’m trying to tween my camera to different points in my map, but it won’t tween and i dont have a CLUE why. If I run it in the command bar? does fine, works wonderfully.

It’s in a localscript and everything is set up correctly(remote wise), everything until the point of the while loop everything works %100 fine.

local TS = game:GetService("TweenService")
game.ReplicatedStorage.fireRibbon.OnClientEvent:Connect(function()
	local cilentCam = Instance.new("Part", workspace)
	cilentCam.Transparency = 1
	cilentCam.CanCollide = false
	cilentCam.Anchored = true
	game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
	cilentCam.CFrame = workspace.CurrentCamera.CFrame
	game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
	while wait() do
		workspace.CurrentCamera.CFrame = cilentCam.CFrame
	end

	game.TweenService:Create(cilentCam, TweenInfo.new(2), {CFrame = workspace.RibbonCameras.Part1.CFrame}):Play()
end)

No errors, nothing.

Thanks :slight_smile:

This while loop here is infinitely yielding the thread, and therefore the Tween underneath it can’t ever be reached.

To fix this, you’ll either need to use a Coroutine to make it yield in a separate thread or place the Tween above the while loop.

Just a warning that this loop is endless and will be created again and again each time the client is fired.

2 Likes