So I have this script to move the camera to a specific part I want:
local Camera = workspace.CurrentCamera
Camera.CameraType = "Scriptable"
for i = 0,1,.001 do --// Our own Tween function
wait()
Camera.CFrame = Camera.CFrame:lerp(workspace.Cam2.CFrame,i)
end
but now if I want to make it go back the camera gets stuck! full script:
local infield = false
local viewing = false
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
script.Parent.BillboardGui.Enabled=true
infield=true
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.E then
if infield then
if viewing then
local Camera = workspace.CurrentCamera
script.Parent.BillboardGui.Enabled=false
Camera.CameraType = "Custom"
Camera.FieldOfView = 20
for i = 0,1,.001 do --// Our own Tween function
wait()
Camera.CFrame = Camera.CFrame:lerp(Camera.CameraSubject,i)
end
else
viewing=true
script.Parent.BillboardGui.Enabled=false
local Camera = workspace.CurrentCamera
Camera.CameraType = "Scriptable"
for i = 0,1,.001 do --// Our own Tween function
wait()
Camera.CFrame = Camera.CFrame:lerp(workspace.Cam2.CFrame,i)
end
end
end
end
end
end)
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
errors: none.

4 comments
If you are using filtering enablrd UserInputService should be acessed from a localscript
It works fine for me probs because of filtering enabled being disabled but I just need to know how to reverse the moving of the cam! now it gets stuck when u try to go back
I can't quite tell completely what is happening here, but my best guess would be to put the camera mode back to "Custom".
If you would have red the first 12 lines you would have seen I put it back to custom :/