Hey there!
So for my game i have a main menu where the player’s camera shifts between scenes. This is working perfectly but now i also need to implement another function. When the player pressed play, i need for the camera to instantly go to the area which the picture below shows.
The only problem is that as you can see from the script below, the camera shifting from the main menu consists of tween animations which have the ‘:wait()’ function in them, so if i try to change the camera CFrame straight to the area in the picture below, it waits for the animation to finish.
Is there any way i could interrupt the animation from another local script?
The area:
The camera shifting (the old version but with same mechanics):
The script:
local camera = workspace.CurrentCamera
local Camera1 = workspace:WaitForChild("Camera1")
local Camera2 = workspace:WaitForChild("Camera2")
local Camera3 = workspace:WaitForChild("Camera3")
local Camera4 = workspace:WaitForChild("Camera4")
local Camera5 = workspace:WaitForChild("Camera5")
local Camera6 = workspace:WaitForChild("Camera6")
local TweenService = game:GetService("TweenService")
local TweenInformation = TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
repeat wait()
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
local goal1 = {CFrame = Camera2.CFrame}
local Animation1 = TweenService:Create(camera,TweenInformation,goal1)
local goal2 = {CFrame = Camera4.CFrame}
local Animation2 = TweenService:Create(camera,TweenInformation,goal2)
local goal3 = {CFrame = Camera6.CFrame}
local Animation3 = TweenService:Create(camera,TweenInformation,goal3)
while true do
camera.CFrame = Camera1.CFrame
wait()
Animation1:Play()
Animation1.Completed:Wait()
camera.CFrame = Camera5.CFrame
Animation3:Play()
Animation3.Completed:Wait()
end
Any help would REALLY be appreciated!