Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

1 comment

0

Nevermind. This wasn't working due to the menu being visible already, instead of it being not visible.

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.