Error in making script

I have an issue which is its stuck i already try to debug and i found where it stucks.

local Cams = game.Workspace.Camera

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Cam = game.Workspace.CurrentCamera
local Recommend = game.ReplicatedStorage.Camera

script.Parent.MouseButton1Click:Connect(function()
	
	Cam.CameraType = Enum.CameraType.Custom
	Cam.CameraType = Enum.CameraType.Scriptable
	
	for _, v in pairs(Cams:GetChildren()) do -- Its stuck here.
		if v.Name == Recommend.Value then
			Cam.CFrame = v.CFrame
		end
	end
end)

I think this will work, just index it and it will be fine.

local Cams = game.Workspace.Camera -- parts im assuming

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Cam = game.Workspace.CurrentCamera
local Recommend = game.ReplicatedStorage.Camera --  a value im assuming

script.Parent.MouseButton1Click:Connect(function()
	Cam.CameraType = Enum.CameraType.Custom
	Cam.CameraType = Enum.CameraType.Scriptable
	
	for _, v in pairs(Cams:GetChildren()) do -- Its stuck here.
		local index = v.Name[Recommended.Value]
		Cam.CFrame = index.CFrame
	end
end)

Still doesnt work, Can someone help me.

Can you give me the error? So I can define what’s wrong in your script.

There was no error at all im still confuse i have try to use GetDescendants but seems it doesnt work to.

Isn’t Camera also the default name of CurrentCamera? Can you try renaming your Camera group to something else?

1 Like

Can you rename this to something random? Because this is the camera that is using in studio.

1 Like