I have a script which is supposed to change the players camera position when they click a button in a SurfaceGUI, how ever this does not work and I do not know why. Can you help?
LocalScript:
local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.CurrentCamera
script.Parent.MouseButton1Click:Connect(function()
local plr = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
repeat wait()
cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable
cam.CFrame = script.Parent.Parent.Parent.Parent.CameraPart.CFrame
end)

3 comments
Use print() statement to determine where the script stops..
Uhmm, I think it should be 'game.Workspace' instead of just 'workspace'. I might be wrong, I haven't actually done it before
No, 'workspace' can work in the place of 'game.Workspace'. If anything, 'workspace' is better because it gets it regardless of workspace's name.