this script is a Local script Inside a GUI and I wanna make it happen for a couple seconds after a certain part has been clicked.
--constants
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
--Camera
repeat wait() until Player.Character
Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CamPart.CFrame
script.Parent.Enabled = true

2 comments
Do not repeat until something exists. And you just asked a question on this?
Put that GUI in ReplicatedStorage, then have the click script clone it into the player's PlayerGui