Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local camera = workspace.CurrentCamera
- local TweenService = game:GetService("TweenService")
- local touchPart = workspace:FindFirstChild("Touch") -- Replace with your part name
- local isPlaying = false -- Cooldown to prevent multiple triggers
- -- Define camera parts and timings
- local cameraParts = {
- workspace.Camera1,
- workspace.Camera2,
- workspace.Camera3
- }
- local cameraTimes = {3, 4, 5} -- Seconds at each camera position
- -- Function to transition smoothly between cameras
- local function playCutscene()
- isPlaying = true -- Start cooldown
- camera.CameraType = Enum.CameraType.Scriptable
- for i = 1, #cameraParts do
- local targetCFrame = cameraParts[i].CFrame
- -- Create a tween for smooth movement
- local tweenInfo = TweenInfo.new(cameraTimes[i], Enum.EasingStyle.Linear)
- local tween = TweenService:Create(camera, tweenInfo, {CFrame = targetCFrame})
- tween:Play() -- Start the tween
- tween.Completed:Wait() -- Wait for the tween to finish
- end
- -- Reset the camera
- camera.CameraType = Enum.CameraType.Custom
- task.wait(4) -- Cooldown duration
- isPlaying = false -- Allow retriggering
- end
- -- Detect when the 'Touch' part is touched
- if touchPart then
- touchPart.Touched:Connect(function(hit)
- local character = hit.Parent
- if character and character:FindFirstChild("Humanoid") and not isPlaying then
- playCutscene()
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment