Script Support needed

Hello, I am trying to do so when you click on a TextLabel your camera switches to another place using tweenservice. The camera does the tweening and changes position to Cam2 place but never to the cam3 place, and it also won’t stop focusing on FocusPart1 which is the first part you see. Anybody help??

I have also probably done this in a bad way using intvalue but I don’t know how else to do it.

local Cam1 = game.Workspace.ShopCameras.Camera1
local Cam2 = game.Workspace.ShopCameras.Camera2
local Cam3 = game.Workspace.ShopCameras.Camera3
local Shop = game.Workspace.Shop
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
wait(2)
local LeftArrow = player.PlayerGui.ShopGUI.LeftArrow
local RightArrow = player.PlayerGui.ShopGUI.RightArrow
local PurchaseButton = player.PlayerGui.ShopGUI.PurchaseButton
local ExitButton = player.PlayerGui.ShopGUI.ExitButton


Shop.Touched:Connect(function(hit)
	
	local FocusPart = game.Workspace.FocusParts.FocusPart1
	
	if hit.Parent:FindFirstChild("Humanoid") then
		cam.CameraType = Enum.CameraType.Fixed
		cam.Focus = workspace.FocusParts.FocusPart1.CFrame
		cam.CFrame = Cam1.CFrame
		cam.FieldOfView = 40
		player.PlayerGui.ShopGUI.Enabled = true
		
		if not player:FindFirstChild("CameraValue") then
			local CameraValue = Instance.new("IntValue")
			CameraValue.Name = "CameraValue"
			CameraValue.Value = 1
			CameraValue.Parent = player
		end
	end
end)

local TweenService = game:GetService("TweenService")

local info = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

local Goals1 = {
	CFrame = Cam1.CFrame;
}
local Goals2 = {
	CFrame = Cam2.CFrame;
}
local Goals3 = {
	CFrame = Cam3.CFrame;
}

local CameraTween1 = TweenService:Create(cam, info, Goals1)
local CameraTween2 = TweenService:Create(cam, info, Goals2)
local CameraTween3 = TweenService:Create(cam, info, Goals3)

RightArrow.MouseButton1Click:Connect(function()
	
	local FocusPart1 = game.Workspace.FocusParts.FocusPart1
	local FocusPart2 = game.Workspace.FocusParts.FocusPart2
	local FocusPart3 = game.Workspace.FocusParts.FocusPart3
	
	local CameraValue = player.CameraValue
	
	if CameraValue.Value == 1 then
		CameraValue.Value = 2
		CameraTween1:Play()
		cam.Focus = FocusPart2.CFrame
	end
	if CameraValue.Value == 2 then
		CameraValue.Value = 3
		CameraTween2:Play()
		cam.Focus = FocusPart3.CFrame
	end
	if CameraValue.Value == 3 then
		CameraValue.Value = 1
		CameraTween2:Play()
		cam.Focus = FocusPart1.CFrame
	end
end)

Copy and paste error?

	if CameraValue.Value == 3 then
		CameraValue.Value = 1
		CameraTween2:Play() -- should be 3?
		cam.Focus = FocusPart1.CFrame
	end
1 Like

Oh thank you didn’t notice, however it still doesn’t work with camera focus and that. I will send a video of what it’s doing. https://medal.tv/games/roblox-studio/clips/BXBGX2Nw_Xafr/d1337fBzlGpG?invite=cr-MSx5enAsMjUzMjEwMzQs

You set the CameratType to Fixed, but you never change it back to anything else.

It still doesn’t work when I set it to somethign else and then back to fixed??