TweenService with camera manipulation problem

I’m trying to make an item shop where you can cycle the camera between items. Currently, it faces the first item for a second then resets the camera to the default position. Any way to fix this? Here’s the script:

local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local CurrentCamera = Workspace.CurrentCamera
local Camera = game.Workspace.Camera

local LocalPlayer = Players.LocalPlayer

local Next = script.Parent:WaitForChild("Right")
local Previous = script.parent:WaitForChild("Left")

local CurrentItem = 1

local Finished = nil
wait()

Next.MouseButton1Click:connect(function()
    	CurrentCamera.CameraType = Enum.CameraType.Scriptable
		if CurrentItem > 3 then
			CurrentItem = 1
	   else
			Finished = Workspace.Cameras[CurrentItem]
			local TweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
			local Goal = {
				CFrame = Finished.CFrame
			}
			local Tween = TweenService:Create(CurrentCamera, TweenInfo, Goal)
		    Tween:Play()
	end
end)

I am not currently utilizing the CurrentItem variables I have in my script. I’m just trying to get the script to work first.

Could you upload a video/screenshots of the issue? It would be very helpful to see the unexpected behavior along with the associated code.

1 Like

Currently it doesn’t look like you’re incrementing the CurrentItem variable, which I would assume is used to signify the item you’re looking at, so it will stay at 1 and only look at the first item.

Currently, I’m just making sure it works before I deal with that.

It won’t let me upload even a 2 second video, so I’ll try to explain it better. When I click the “right” button, the camera moves away from the player and faces the item for about a second, then resets to the default view of the player. I’m think this may have something to do with the Tween ending? I’m not sure. Sorry I couldn’t upload the video.