Carkzowk

Se

Jan 28th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. local camera = workspace.CurrentCamera
  2. local TweenService = game:GetService("TweenService")
  3. local Players = game:GetService("Players")
  4. local touchPart = workspace:FindFirstChild("Touch") -- Replace with your part name
  5. local isPlaying = false -- Cooldown to prevent multiple triggers
  6.  
  7. -- Define camera parts and timings
  8. local cameraParts = {
  9. workspace.Camera1,
  10. workspace.Camera2,
  11. workspace.Camera3
  12. }
  13. local cameraTimes = {3, 4, 0} -- Seconds for tweening to each camera position (Camera3 has manual delay)
  14.  
  15. -- Function to create a black fade-in effect
  16. local function createFadeScreen(duration)
  17. local player = Players.LocalPlayer
  18. local playerGui = player:WaitForChild("PlayerGui")
  19.  
  20. local fadeFrame = Instance.new("ScreenGui", playerGui)
  21. fadeFrame.IgnoreGuiInset = true
  22.  
  23. local blackFrame = Instance.new("Frame", fadeFrame)
  24. blackFrame.Size = UDim2.new(1, 0, 1, 0)
  25. blackFrame.BackgroundColor3 = Color3.new(0, 0, 0)
  26. blackFrame.BorderSizePixel = 0
  27.  
  28. local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear)
  29. local fadeTween = TweenService:Create(blackFrame, tweenInfo, {BackgroundTransparency = 1})
  30.  
  31. fadeTween:Play()
  32. fadeTween.Completed:Wait()
  33. fadeFrame:Destroy()
  34. end
  35.  
  36. -- Function to show dialogue
  37. local function showDialogue()
  38. local playerName = Players.LocalPlayer.Name -- Player's name
  39. local dialogue = {
  40. playerName .. ": Hi and who are you?",
  41. "Rip_ahmed: I am the one who completed this game before!",
  42. "Rip_ahmed: I can say that you can't complete this game easily!",
  43. "Rip_ahmed: If you really can, so try it by yourself.",
  44. playerName .. ": Ok..."
  45. }
  46.  
  47. for _, line in ipairs(dialogue) do
  48. print(line) -- Replace with GUI code if you want the dialogue displayed in a GUI
  49. task.wait(3) -- Wait time for each dialogue line
  50. end
  51. end
  52.  
  53. -- Function to play the cutscene
  54. local function playCutscene()
  55. isPlaying = true -- Start cooldown
  56. camera.CameraType = Enum.CameraType.Scriptable
  57.  
  58. -- Black fade-in before cutscene starts
  59. createFadeScreen(2)
  60.  
  61. for i = 1, #cameraParts do
  62. local targetCFrame = cameraParts[i].CFrame
  63.  
  64. -- Create a tween for smooth movement
  65. local tweenInfo = TweenInfo.new(cameraTimes[i], Enum.EasingStyle.Linear)
  66. local tween = TweenService:Create(camera, tweenInfo, {CFrame = targetCFrame})
  67.  
  68. tween:Play() -- Start the tween
  69. tween.Completed:Wait() -- Wait for the tween to finish
  70.  
  71. -- If at Camera3, display dialogue and wait 30 seconds
  72. if i == 3 then
  73. showDialogue()
  74. task.wait(30)
  75. end
  76. end
  77.  
  78. -- Reset the camera
  79. camera.CameraType = Enum.CameraType.Custom
  80. task.wait(4) -- Cooldown duration
  81. isPlaying = false -- Allow retriggering
  82. end
  83.  
  84. -- Detect when the 'Touch' part is touched
  85. if touchPart then
  86. touchPart.Touched:Connect(function(hit)
  87. local character = hit.Parent
  88. if character and character:FindFirstChild("Humanoid") and not isPlaying then
  89. playCutscene()
  90. end
  91. end)
  92. end
Advertisement
Add Comment
Please, Sign In to add comment