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)

2 comments

0

where did u put the SurfaceGui?

0

in the part