focus.OnClientEvent:Connect(function(focusPart)
local Goal = {}
Goal.CFrame = CFrame.lookAt(Camera.CFrame.Position, focusPart.Position)
print(Goal)
local Info = TweenInfo.new(
0.75,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local tween = TweenService:Create(Camera, Info, Goal)
tween:Play()
end)
At the end of the “looking at” animation, camera moves back to a position, which doesn’t look good.
I checked with print and found out that Default Roblox Camera normally changes camera position when we are rotating camera, but in this Tween I force it to keep same.
Got no way to test this code so ill just wing it but, personally instead of tweening i would use lerping for focusing the camera.
Im going to assume that you’re using a custom camera controller and not just zoomed in
focus.OnClientEvent:Connect(function(focusPart)
local goalCframe = focusPart.Position
local lerpAlpha = 0.4 -- Adjust this to your liking ( Between 0 and 1 )
Camera.CFrame:Lerp(CFrame.lookAt(Camera.CFrame.Position, goalCframe), lerpAlpha)
end)
If i were you, id also add a way to stop the player from moving their camera while focusing.
Game looks pretty sick tho, i’d love to try it when you’re complete.
Did you try the script i sent you? Let me know what happens, i think you may need to set the cameraType to scriptable when you tween or lerp its CFrame, otherwise roblox overrides it