I’m trying to write code that, if a player touches a death plane, the camera will follow them as they fall. However, sometimes, the camera snaps in another direction if the player ends up falling underneath the camera. Here’s a demonstration of what I mean:
Is there any way of preventing this? I can’t even find anything unusual when I print its LookVector.
Here’s the code I have:
local function TouchPlayer()
--Kill player
if debounce == false then
debounce = true
local camera = workspace.CurrentCamera
local camerapos = camera.CFrame.p
camera.CameraType = Enum.CameraType.Scriptable
for i = 1, 80 do --Camera follows player
camera.CFrame = CFrame.new(camerapos, player.Character.HumanoidRootPart.Position)
game:GetService("RunService").Heartbeat:Wait()
end
ReloadEvent:Fire("deathplane", 0)
wait(5)
debounce = false
end
end