Camera Not Working

I am making a script where the camera changes its CFrame across different parts.

The CFrame of the camera changes but I see the same thing. Here is the video:

Here is the script.

-- Varibles
local Camera = game.Workspace.CurrentCamera
local CameraFolder = game.Workspace.CameraAnchors

local CurrentValue = script:WaitForChild("CurrentValue")

-- Camera Change Function
local function ChangeCamera()
	Camera.CFrame =  CameraFolder:FindFirstChild("CameraAnchor"..CurrentValue.Value).CFrame
	print(Camera.CFrame)
end

Camera.CameraType = Enum.CameraType.Scriptable
script.Parent.NameTextLabel.Text = CameraFolder:WaitForChild("CameraAnchor"..CurrentValue.Value).PartName.Value
ChangeCamera()

-- Button Function
local function ChangeValueButton(Left: boolean)
	if Left == true and CurrentValue.Value ~= 1 then
		CurrentValue.Value -= 1
		ChangeCamera()
	elseif Left == false and CurrentValue.Value ~= #CameraFolder:GetChildren() then
		CurrentValue.Value += 1
		ChangeCamera()
	elseif Left == true and CurrentValue.Value == 1 then
		CurrentValue.Value = #CameraFolder:GetChildren()
		ChangeCamera()
	elseif Left == false and CurrentValue.Value == #CameraFolder:GetChildren() then
		CurrentValue.Value = 1
		ChangeCamera()
	end
end

-- Main Function 
script.Parent.RightButton.MouseButton1Click:Connect(function()
	ChangeValueButton(false)
	
	script.Parent.NameTextLabel.Text = CameraFolder:FindFirstChild("CameraAnchor"..CurrentValue.Value).PartName.Value
end)

script.Parent.LeftButton.MouseButton1Click:Connect(function()
	ChangeValueButton(true)

	script.Parent.NameTextLabel.Text = CameraFolder:FindFirstChild("CameraAnchor"..CurrentValue.Value).PartName.Value
end)

Thank you for your help! :slight_smile:

1 Like

Nevermind, it was my free camera script that always changed the position so it looked like it didn not work! :slight_smile: :pray:

1 Like

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