local cam = game.Workspace.CurrentCamera
local spectate = false
function get()
for _, v in pairs(workspace.Model:GetChildren()) do
if v.Name == script.Parent.TextButton.Text then
return(_)
end
end
end
local debounce = false
script.Parent.TextButton.MouseButton1Click:connect(function()
spectate=true
print("loo")
if debounce==false then
debounce= true
cam.CameraSubject = game.Workspace.Model.point1
script.Parent.TextButton.Text = cam.CameraSubject.Name
print("lol")
elseif debounce==true then
debounce=false
cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
end
end)
script.Parent.troll.MouseButton1Click:connect(function()
wait(0.1)
local num = get()
local this = num+1
workspace.Model["point" .. tostring(this) ] = cam.CameraSubject
script.Parent.TextButton.Text=cam.CameraSubject.Name
end)
Yes, so this is the code in a local script. It often says point2 is not a valid member of model when it is if I look on the hierarchy.

2 comments
if the function get does not find the part name then num will be nill, the code does not handle this scenario.
Just a little fyi, the two variables for a for loop are like this the first one is the number in the loop that it was found, and the second one is the object it got.