Camera Moving to incorrect position

Hello, so i writed code for whenever player clicks on gui button camera should move to the certain part. but it doesnt work. can anyone tell me why?

local plr = game.Players.LocalPlayer;
local gui = plr.PlayerGui;
local character = plr.Character;
local humanoid = character:WaitForChild("Humanoid");
local landTerraformationButton =gui.ScreenGui:WaitForChild("TerraformButton");
local upButton = gui.ScreenGui:WaitForChild("UpTerraform");
local downButton =gui.ScreenGui:WaitForChild("DownTerraform");

local ts = game:GetService("TweenService")
local rs = game:GetService("RunService")
local plr = game:GetService("Players")

local camera = workspace.CurrentCamera
local truth = true

local oldcamera = camera.CFrame;

	if truth then
		print("Stage Alpha1...")
		truth = false

		camera.CFrame = workspace.Part.CFrame
		print("Stage Alpha2...")
		truth = true;
		camera.CFrame = oldcamera;
	upButton.Visible = not upButton.Visible
	downButton.Visible = not downButton.Visible

You don’t need to use oldcamera just set the camera type to Custom

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.