Advertisement
qsenko1

Camera TweenStuff

Oct 7th, 2021
847
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.89 KB | None | 0 0
  1. WalterHitbox.Touched:Connect(function(hit)
  2.     if hit.Parent:FindFirstChild("Humanoid") and Player and debounces.debounce1 == true then
  3.         debounces.debounce1 = false
  4.        
  5.         if Player.PlayerGui:WaitForChild("LocalSounds").HellTower.Playing == true and Sky.SkyboxBk == "http://www.roblox.com/asset/?id=227620983" then
  6.             Player.PlayerGui:WaitForChild("LocalSounds").HellTower.Playing = false
  7.             Player.PlayerGui:WaitForChild("LocalSounds").HellTower:Stop()
  8.         --  print("false1")
  9.         end
  10.        
  11.         if Player.PlayerGui:WaitForChild("LocalSounds").YellowTower.Playing == true or game.SoundService.YellowTower.Playing == true and Sky.SkyboxBk == "rbxasset://textures/sky/sky512_bk.tex" then
  12.             Player.PlayerGui:WaitForChild("LocalSounds").YellowTower.Playing = false
  13.             game.SoundService.YellowTower.Playing = false
  14.             game.SoundService.YellowTower:Stop()
  15.         --  print("false2")
  16.         end
  17.        
  18.         if Player.PlayerGui:WaitForChild("LocalSounds").PirateSong.Playing == true and Sky.SkyboxBk == "rbxassetid://653719502" then
  19.             Player.PlayerGui:WaitForChild("LocalSounds").PirateSong.Looped = false
  20.             Player.PlayerGui:WaitForChild("LocalSounds").PirateSong.Playing = false
  21.             Player.PlayerGui:WaitForChild("LocalSounds").PirateSong:Stop()
  22.         end
  23.        
  24.         local players = game.Players:GetChildren()
  25.         for i = 1,#players do
  26.             if players[i].Name ~= Player.Name then
  27.                 table.insert(plrs,workspace[players[i].Name])
  28.             end
  29.         end
  30.         for i = 1,#plrs do
  31.             plrs[i].Parent = nil
  32.         end
  33.        
  34.         -- Trap
  35.         local Trap = game.ReplicatedStorage.LabLevelStuff.Trap:Clone()
  36.         Trap.Parent = game.Workspace
  37.        
  38.         local humanoid = Player.Character:FindFirstChildOfClass("Humanoid")
  39.         humanoid:UnequipTools()
  40.        
  41.         Player.Character.HumanoidRootPart.CFrame = CFrame.new(-12793.469, 695.633, 601.826) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))
  42.        
  43.         wait(.1)
  44.        
  45.         UnequipPart:Clone()
  46.         UnequipPart.Parent = game.Workspace
  47.         UnequipPart.CFrame = CFrame.new(-12793.467, 697.238, 601.826) * CFrame.Angles(math.rad(0),math.rad(180),math.rad(0))
  48.         hit.Parent:FindFirstChild("Humanoid").WalkSpeed = 0
  49.         hit.Parent:FindFirstChild("Humanoid").JumpHeight = 0       
  50.        
  51.         local StarterGui = game:GetService("StarterGui")
  52.         StarterGui:SetCore("ResetButtonCallback",false)
  53.         hit.Parent:FindFirstChild("Humanoid").WalkSpeed = 0
  54.         hit.Parent:FindFirstChild("Humanoid").JumpHeight = 0
  55.         -- Cutscene code
  56.         local Camera = workspace.CurrentCamera 
  57.         Camera.CameraType = Enum.CameraType.Scriptable
  58.         --  Camera.HeadLocked = false
  59.         --  Camera.CameraType = Enum.CameraType.Fixed
  60.     --  local DefaultPart = game.Workspace.Part32
  61.         local function tween(part1,part2,cutsceneTime)
  62.            
  63.             local tweenInfo = TweenInfo.new(
  64.                 cutsceneTime,
  65.                 Enum.EasingStyle.Sine,
  66.                 Enum.EasingDirection.Out,
  67.                 0,
  68.                 false,
  69.                 0
  70.     )  
  71.            
  72.             --Camera.CFrame = part1.CFrame * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)) --DefaultPart.CFrame
  73.            
  74.             --Camera.Focus = DefaultPart.CFrame
  75.             Camera.CameraSubject = part1
  76.             local tween = TweenService:Create(Camera,tweenInfo,{CFrame = part2.CFrame})
  77.             tween:Play()
  78.            
  79.             wait(cutsceneTime)
  80.            
  81.             Camera.CameraType = Enum.CameraType.Custom 
  82.             Camera.CameraSubject = part2
  83.         end
  84.        
  85.         wait(.5)
  86.         TextLabel.Parent.Visible = true
  87.         BlackScreen.Visible = true     
  88.         wait(.1)
  89.                
  90.         --local transparency = 10
  91.        
  92.         for i = 1, 10 do
  93.             BlackScreen.BackgroundTransparency = i/10
  94.             wait(0.075)
  95.         end
  96.        
  97.         -- tween(Camera,game.Workspace.Part32,5)
  98.         --  tween.Completed:Wait()
  99.         --  print("hi")
  100.         --tween(Camera,game.Workspace.Part32,10)
  101.         --tween(game.Workspace.Cameras.camera2,game.Workspace.Cameras.camera3,10)
  102.        
  103.     --  wait(1)
  104.        
  105.         BlackScreen.Visible = false
  106.         --camera tween start here  
  107.         --print("camera started tweening")
  108.        
  109.         local function typewrite(object,text,lenght)
  110.             for i = 1, #text,1 do
  111.                 object.Text = string.sub(text,1,i)
  112.                 wait(lenght)
  113.             end
  114.         end    
  115.        
  116.         typewrite(TextLabel,"The Lab",0.05)
  117.        
  118.         tween(game.Workspace.Cameras.cam1,game.Workspace.Cameras.cam2,5)
  119.        
  120.         wait(.5)
  121.         script.TextScript.Disabled = false
  122.        --[[TextLabel.Text = "he Lab"
  123.         wait(0.05)
  124.         TextLabel.Text = "e Lab"
  125.         wait(0.05)
  126.         TextLabel.Text = " Lab"
  127.         wait(0.05)
  128.         TextLabel.Text = "Lab"     
  129.         wait(0.05)
  130.         TextLabel.Text = "ab"
  131.         wait(0.05)
  132.         TextLabel.Text = "b"
  133.         wait(0.05)
  134.         TextLabel.Text = ""]]--
  135.        
  136.         tween(game.Workspace.Cameras.cam2,game.Workspace.Cameras.cam1,5)
  137.         --wait(1)
  138.         TextLabel.Parent.Visible = false       
  139.        
  140.         WalterAnimationTrack:Play()
  141.         -- tween from walter to character
  142.         --Camera.Focus = Walter.HumanoidRootPart.CFrame
  143.         --Camera.CFrame = Walter.HumanoidRootPart.CFrame * CFrame.Angles(0,90,0)
  144.         --tween(game.Workspace.Cameras.cam3,Player.Character.HumanoidRootPart,9)
  145.         --  Camera.DiagonalFieldOfView = 50
  146.         --  Camera.CFrame.LookVector = CFrame.new(0,0,0) * CFrame.Angles(0,0,0)
  147.     --  Camera.CFrame = CFrame.new(Camera.CFrame.Position, game.Workspace.Cameras.cam3.CFrame.LookVector) -- works but strange
  148.         --Camera.CameraType = Enum.CameraType.Scriptable
  149.         --Camera.CameraType = "Track"
  150.     --  Camera.CameraSubject = game.Workspace.Cameras.cam3
  151.         --Camera.CameraType = "Scriptable"
  152.         tween(game.Workspace.Cameras.cam3,game.Workspace.Cameras.cam4,5.5)
  153.         tween(game.Workspace.Cameras.cam4,Player.Character.HumanoidRootPart,1) 
  154.         Camera.CameraSubject = Player.Character.Humanoid
  155.      -- Camera.DiagonalFieldOfView = 70
  156.         --print("WalterAnimation")
  157.         wait(25)
  158.     --  print("First animation ended")
  159.         --Camera.CameraSubject = game.Workspace.Cameras.cam1
  160.         Camera.CFrame = game.Workspace.Cameras.cam1.CFrame -- Not sure if it does anything,deleting this is not fatal at all!!
  161.         -- play second animation
  162.        
  163.         TextLabel.Parent.Visible = true
  164.         BlackScreen.Visible = true     
  165.         BlackScreen.BackgroundTransparency = 0
  166.         TextLabel.TextStrokeColor3 = Color3.fromRGB(255, 5, 9)
  167.         typewrite(TextLabel,"10 Minutes Later",0.05)
  168.        
  169.         wait(.5)
  170.        
  171.         Camera.CameraSubject = game.Workspace.Cameras.cam1
  172.        
  173.         for i = 1, 10 do
  174.             BlackScreen.BackgroundTransparency = i/10
  175.             wait(0.075)
  176.         end
  177.        
  178.         tween(game.Workspace.Cameras.cam1,game.Workspace.Cameras.cam5,5)
  179.         Alien1Track:Play()
  180.         Alien2Track:Play()
  181.         Alien3Track:Play()
  182.         TextLabel.Text = "10 Minutes Later"
  183.         wait(0.05)
  184.         TextLabel.Text = "0 Minutes Later"
  185.         wait(0.05)
  186.         TextLabel.Text = " Minutes Later"
  187.         wait(0.05)
  188.         TextLabel.Text = "Minutes Later"       
  189.         wait(0.05)
  190.         TextLabel.Text = "inutes Later"
  191.         wait(0.05)
  192.         TextLabel.Text = "nutes Later"
  193.         wait(0.05)
  194.         TextLabel.Text = "utes Later"
  195.         wait(0.05)
  196.         TextLabel.Text = "tes Later"
  197.         wait(0.05)
  198.         TextLabel.Text = "es Later"
  199.         wait(0.05)
  200.         TextLabel.Text = "s Later"
  201.         wait(0.05)
  202.         TextLabel.Text = " Later"
  203.         wait(0.05)
  204.         TextLabel.Text = "Later"
  205.         wait(0.05)
  206.         TextLabel.Text = "ater"
  207.         wait(0.05)
  208.         TextLabel.Text = "ter"
  209.         wait(0.05)
  210.         TextLabel.Text = "er"
  211.         wait(0.05)
  212.         TextLabel.Text = "r"
  213.         wait(0.05)
  214.         TextLabel.Text = ""
  215.        
  216.         BlackScreen.Visible = false
  217.         TextLabel.Parent.Visible = false
  218.         --Camera.CameraType = Enum.CameraType.Scriptable
  219.     --  Camera.CameraSubject = game.Workspace.Cameras.cam5
  220.         Camera.CFrame = CFrame.new(Camera.CFrame.Position, game.Workspace.Cameras.cam5.Position)
  221.         --Camera.Focus = game.Workspace.Cameras.cam5.CFrame
  222.         wait(10)
  223.         Camera.CameraType = Enum.CameraType.Custom
  224.         Camera.CameraSubject = Player.Character.Humanoid -- maybe set it up when the animation ends
  225.         wait(.5)
  226.         BlackScreen.Visible = false
  227.         BlackScreen.BackgroundTransparency = 1
  228.        
  229.         for i = 1,#plrs do
  230.             plrs[i].Parent = workspace
  231.         end
  232.        
  233.         plrs = {}
  234.         -- destroy the part that wont let you equip a tool while in the cutscene mode
  235.         game.Workspace.LabLevelUnequipPart:Destroy()
  236.         game.Workspace.Trap:Destroy()
  237.         -- sets your default jump and speed back to normal
  238.         hit.Parent:FindFirstChild("Humanoid").WalkSpeed = 16
  239.         hit.Parent:FindFirstChild("Humanoid").JumpHeight = 7.2
  240.         -- can suicide agen yay:)
  241.         StarterGui:SetCore("ResetButtonCallback",true)
  242.        
  243.         if Player.PlayerGui:WaitForChild("LocalSounds").HellTower.Playing == false and Sky.SkyboxBk == "http://www.roblox.com/asset/?id=227620983" then
  244.             Player.PlayerGui:WaitForChild("LocalSounds").HellTower.Playing = true
  245.             Player.PlayerGui:WaitForChild("LocalSounds").HellTower:Play()
  246.             --print("false3")
  247.         end
  248.  
  249.         if Player.PlayerGui:WaitForChild("LocalSounds").YellowTower.Playing == false and Sky.SkyboxBk == "rbxasset://textures/sky/sky512_bk.tex" then
  250.             Player.PlayerGui:WaitForChild("LocalSounds").YellowTower.Playing = true
  251.             Player.PlayerGui:WaitForChild("LocalSounds").YellowTower:Play()
  252.             --print("false4")
  253.         end
  254.        
  255.         if Player.PlayerGui:WaitForChild("LocalSounds").PirateSong.Playing == false and Sky.SkyboxBk == "rbxassetid://653719502" then
  256.             Player.PlayerGui:WaitForChild("LocalSounds").PirateSong.Looped = true
  257.             Player.PlayerGui:WaitForChild("LocalSounds").PirateSong.Playing = true
  258.             Player.PlayerGui:WaitForChild("LocalSounds").PirateSong:Play()
  259.         end
  260.        
  261.         --debounces.debounce1 = true
  262.     end
  263. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement