I've made a local script that plays a cutscene when a player starts the game, the camera stays in the same position at the end. But I want to make a button that returns to the player's default camera position. how can I do this? I've tried disabling the local script won't it won't work.
Here is the cutscene local script:
local TweenService = game:GetService("TweenService") local camera = game.Workspace.Camera local PlayButton = script.Parent local cutsceneTime = 3 --this will change the length of your cutscene in seconds local tweenInfo = TweenInfo.new( cutsceneTime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0 )
local function tween(part1,part2) camera.CameraType = Enum.CameraType.Scriptable camera.CFrame = part1.CFrame
1 | local tween = TweenService:Create(camera, tweenInfo, { CFrame = part 2. CFrame } ) tween:Play() |
2 |
3 | PlayButton.MouseButton 1 Click:Connect( function () |
4 |
5 | camera.CameraType = Enum.CameraType.Custom |
6 | end ) |
end
wait()
tween(Workspace.Test1, Workspace.Test2)