The issue occurs in a specific location and angle. When the player is moving at high speed, the car disappears and reappears quickly. I initially thought it was related to StreamingEnabled, but even with it turned off, the problem still happens.
However, when I make any selection, the issue disappears. Yet, this also happens outside of Studio.(In Game)
I don’t think it has anything to do with a camera script, as the only one I use is this one:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local clientScripts = script.Parent
local camera = workspace.CurrentCamera
local car = clientScripts:FindFirstAncestorOfClass("Model")
local driveSeat = car:WaitForChild("VehicleSeat")
local enabled = false
local heartbeatConnection = nil
local maxTiltAngle = 15
local maxOffset = Vector3.new(0, 8, -15)
local smoothness = 0.1
local baseFoV = 70
local maxFoVIncrease = 30
local function update()
if camera.CameraType ~= Enum.CameraType.Custom then
--camera.CameraType = Enum.CameraType.Custom
end
if camera.CameraSubject ~= driveSeat then
camera.CFrame = driveSeat.CFrame
camera.CameraSubject = driveSeat
end
local speed = driveSeat.Velocity.Magnitude
local normalizedSpeed = math.min(speed / 200, 1)
local positionOffset = Vector3.new(0, 8 - (normalizedSpeed * maxOffset.Y), -10 - (normalizedSpeed * maxOffset.Z))
local tiltAngle = normalizedSpeed * maxTiltAngle
local cameraPosition = driveSeat.CFrame.Position + positionOffset
local tiltCFrame = CFrame.Angles(math.rad(-tiltAngle), 0, 0)
local newCFrame = CFrame.new(cameraPosition) * tiltCFrame
local newFoV = baseFoV + (normalizedSpeed * maxFoVIncrease)
camera.CFrame = camera.CFrame:Lerp(newCFrame, smoothness)
camera.FieldOfView = camera.FieldOfView + (newFoV - camera.FieldOfView) * smoothness
end
local Camera = {}
function Camera:enable()
if enabled then
return
end
enabled = true
heartbeatConnection = RunService.Heartbeat:Connect(update)
end
function Camera:disable()
if not enabled then
return
end
enabled = false
if heartbeatConnection then
heartbeatConnection:Disconnect()
heartbeatConnection = nil
end
camera.FieldOfView = baseFoV
end
return Camera