I’m very new to CFrames and i don’t understand how i can make the camera stay at the end position of the Tween.
What i’m trying to do is making the camera stay at a certain position relative to the car position and follow at the car smoothly. without any instant teleportation.
local function updateCamera()
local tweenInfo = TweenInfo.new(
3, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local tween = TweenService:Create(
workspace.Camera,
tweenInfo,
{CFrame = CFrame.new(_G.car.Visual.CameraPoints["CameraPoint" ..
CurrentCamera].CFrame.Position,_G.car.Chassis.BackBone.Position)}
)
tween:Play()
tween.Completed:Wait()
end
This issue is most likely caused by the fact your Camera.CameraType isn’t set to CameraType.Scriptable, so after your tween finishes, it reverts back to the original camera angle since you aren’t actively updating the camera CFrame.
Sidenotes
You should use workspace.CurrentCamera instead, as that’s what the camera being used by the Players.LocalPlayer will always be. Looking for workspace.Camera may be unreliable at times.
It’s unnecessary to define every parameter in TweenInfo.new(). It would act the same if you did TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), and is faster to type in my opinion.