How do i make a thing that spectates a part

I need a thing where you can spectate a part for my game

local camera = game.WorkSpace.CurrentCamera

-- It Will change the part that the camera If fixed to --
camera.CameraSubject = partToWatch

Is there there a way where i can put a button when they click it it changes where there spectating?

Insert a local script to the Button and change the player camera subject to the part u want to

Like this?

local camera = game.WorkSpace.CurrentCamera

camera.CameraSubject = partToWatch
wait(0.5)
camera.CameraSubject = partToWatch

Oh alright ill try that right now

Yes u can make It to what u want it to

How do i make it when they press a button thing

I only know very basic coding so im not really good at it

Button local script:

local button = script.Parent
local player = game.Players.LocalPlayer
local camera = game.WorkSpace.CurrentCamera

-- Fires when u click the Button --
button.Activated:Connect(function()
  camera.CameraSubject = game.WorkSpace.PartYouWant
end)

its not working, what do i do?

Look here is a screenshot

Should be a local script instead.