Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't the tween stopping and the camera resetting to normal?

Asked by 3 years ago

I am trying to make the camera return to the player and stop a tween once the player closes the menu. For some reason the GUI disappears like normal, but the tween doesn't stop nor does the camera change. Here is the script i'm using:

-- Varibles --
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local TweenService = game:GetService("TweenService")

repeat wait() until Player.Character

-- Function --
script.Parent.Parent.ReturnMenu.TextButton.MouseButton1Click:Connect(function()
    script.Parent.Enabled = true
    script.Parent.Parent.ReturnMenu.TextButton.Visible = false
    Camera.CameraType = Enum.CameraType.Scriptable
    Camera.CFrame = game.Workspace.Cameras.A.CFrame
    local TweeningInfo = TweenInfo.new(60,Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut,0)
    local CutsceneAProperties = {CFrame = game.Workspace.Cameras.B.CFrame}
    local CutsceneBProperties = {CFrame = game.Workspace.Cameras.D.CFrame}
    MenuCutsceneA = TweenService:Create(Camera,TweeningInfo,CutsceneAProperties)
    MenuCutsceneB = TweenService:Create(Camera,TweeningInfo,CutsceneBProperties)
    MenuCutsceneA:Play()
    wait(61)
    Camera.CFrame = game.Workspace.Cameras.C.CFrame
    MenuCutsceneB:Play()
    wait(61)
end)

script.Parent.Frame.exit.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.PlayerGui.Menu.Frame.Visible = false
    MenuCutsceneA:Pause()
    MenuCutsceneB:Pause()
    Camera.CameraType = Enum.CameraType.Custom
    Camera.CameraSubject = "Humanoid"
end)
0
Nevermind. This wasn't working due to the menu being visible already, instead of it being not visible. User#37681 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Lol, I figured it out.

Ad

Answer this question