Hello everyone,
I have this problem that I been struggling off, and It's camera interpolation.
How script works: The camera follows the part using while loop.
LeftBracket - Enable Follow Camera [Working Fine]
RightBracket - Disable Follow Camera [Working Fine]
The problem is whenever the part is destroyed and I spawned a NEW part the camera is stuck on the same CFrame
Here is the LocalScript Code:
wait(2)
-- print("Script is running")
-- Variables
local Camera = workspace.CurrentCamera
local FocusPart = workspace:WaitForChild("Handball")
local EndPart = workspace:WaitForChild("EndPart")
local UIS = game:GetService("UserInputService")
local FOV = Camera.FieldOfView
_G.Enabled = false
UIS.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.LeftBracket then
_G.Enabled = true
while _G.Enabled == true do
wait()
FOV = 30
Camera.CameraType = "Scriptable"
Camera:Interpolate(EndPart.CFrame, FocusPart.CFrame, 2)
end
end
end)
UIS.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.RightBracket then
_G.Enabled = false
wait(1)
FOV = 70
Camera.CameraType = "Custom"
Camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
end
end)

2 comments
tbh I don't even know why I used _G for my Enabled, lol
Edit: Didn't seem to work