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.