Make a button that changes from scripted camera type to follow?

I am making a very early alpha of my game and i want a temp button to make the camera normal and not the RPG camera i have in it so i have a button but the game doesnt like me changing the camera type after its been scripted so it changes the type but behaves the same and if i delete it after changing the camera type it freezes the camera
Here is the buttons code:
local camera = workspace.CurrentCamera

function leftClick()

camera.CameraType = Enum.CameraType.Follow

end

script.Parent.MouseButton1Click:Connect(leftClick)
1 Like

You should make it scriptable first, then make it follow.

You’d most likely be missing out that there’s a difference between LocalScript and Script. Otherwise, there’s something I might have overlooked.

Try this make sure you put these as local script

local camera = workspace.CurrentCamera
game.Players.PlayerAdded:connect(function()
camera.CameraType = Enum.CameraType.Scriptable
end)
function leftClick()

camera.CameraType = Enum.CameraType.Follow

end

script.Parent.MouseButton1Click:Connect(leftClick)

I know that Local Scripts are client side and Scripts are server side i have that in a LocalScript and @ItzMeZeus_IGotHacked thats what i was doing

I have it set to scriptable and it stays the same when changing to follow and i know to put it in a local script

Have you tried

camera.CameraSubject

How does

camera.CameraSubject

work and how do i use it?
Because my RPG Camera script doesnt use that

That assigns a camera subject. If the camera type is right, it should move the camera’s focus to any BasePart it is focusing.

2 Likes

Thanks! I brought up the Developer Hub page about it and it shows how it works so thanks for telling me about it

1 Like

The CameraSubject doesnt do anything for fixing the camera

Try switching the CameraType to Custom, which is default by the API page. If that doesn’t work, something is out of place.