Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make it so that the camera returns to the player?

Asked by 3 years ago
Edited 3 years ago

I need some help trying to get the camera to return to the player.

So I got this script to work with my GUI's (Script below) and I can't figure out how to script it so the camera returns to the player after they hit the play button, Because right now everything works but the camera is stuck in the camera transition phases from block to block but gets stuck once it stops at the end block and won't move on to the 2nd set of blocks.

This script is a localscript.

01-- Locals
02local tween = game:GetService("TweenService")
03local cam = workspace.Camera
04local scenes = workspace.CameraScenes
05local currentTween = nil
06local looping = true
07 
08repeat wait() until cam.CameraSubject ~= nil
09 
10cam.CameraType = Enum.CameraType.Scriptable
11 
12while true do
13    for i, v in pairs(scenes:GetChildren()) do
14        if looping == false then return end
15        cam.CFrame = v["1"].CFrame
16        currentTween = tween:Create(cam, TweenInfo.new(10), {CFrame = v["2"].CFrame})
17        currentTween:Play()
18        wait(10)
19    end
20end

Answer this question