Tween focus help

I am trying to tween the camera but the focus is not going to the correct area. Do you know why it will not focus on this CFrame. Here is the script:

local tween1 = tweenService:Create(
	Camera,
	TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
	{
		CFrame = CFrame.new( 105.530022, 281.960022, 98.2499924, 1, 0, 0, 0, 1, 0, 0, 0, 1),
		Focus = CFrame.new(121.424995, 265.545013, 144.409988, 1, 0, 0, 0, 1, 0, 0, 0, 1)
	}
)

I already have my variables defined, it should be pretty straight forward as to what they are.

1 Like

You gotta actually do tween1:Play().

I did, the focus is not working.

Ok, try defining all tweeninfo parameters. Also what do you need focus for? It just prioritizes what area in space that roblox prioritizes when giving good graphics. Nothing like pointing the camera at that space I’m pretty sure.

I need it to focus on a parts CFrame, the cframe up there is the cframe of the parts I want it to focus on.

Oh ok. It’s really simple. Just do this:

{CFrame = CFrame.new(CameraPosition, PositionWhereCameraLooksAt)}
--- Example
{CFrame = CFrame.new(CameraPosition, PartToLookAt.Position)}

The second parameter in the CFrame is the position that the part that you are changing the CFrame of should look at. The first parameter is just the position you want the part to be.

It still is not focusing on the parts CFrame.

I’m confused what you’re trying to achieve. Show me what code you’ve put in so far. Do you want the camera to look at a part? What do you mean by focus since I don’t know if you want it to like zoom into the part or something.

I tried sending this before but my internet cut out so if it sends twice somehow sorry lol

Focus doesn’t actually set where the camera is, only the area that the graphics engine should prioritize the most

I’m not sure about this but I think you can just do this:

local Position = Vector3.new(put whatever you want here)
local LookAt = Vector3.new(also put whatever you want)

local tween1 = tweenService:Create(
	Camera,
	TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
	{
		CFrame = CFrame.new(Position, LookAt)
	}
)

Then you just do your funky tween1:Play() or something lol

local Blur = Instance.new("BlurEffect")
Blur.Parent = Camera
Blur.Name = "Blur"
Blur.Size = 22

local tween1 = tweenService:Create(
	Camera,
	TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
	{
		CFrame = CFrame.new( 105.530022, 281.960022, 98.2499924, 1, 0, 0, 0, 1, 0, 0, 0, 1),
		Focus = CFrame.new(121.424995, 265.545013, 144.409988, 1, 0, 0, 0, 1, 0, 0, 0, 1)
	}
)
local tween2 = tweenService:Create(
	Camera,
	TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
	{
		CFrame = CFrame.new(  74.6900177, 281.960022, 144.309998, 1, 0, 0, 0, 1, 0, 0, 0, 1),
		Focus = CFrame.new(121.424995, 265.545013, 144.409988, 1, 0, 0, 0, 1, 0, 0, 0, 1)
	}
)

local tween3 = tweenService:Create(
	Camera,
	TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
	{
		CFrame = CFrame.new(  105.530022, 281.960022, 188.369995, 1, 0, 0, 0, 1, 0, 0, 0, 1),
		Focus = CFrame.new(121.424995, 265.545013, 144.409988, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.Angles(0,math.rad(-45),0)
	}
)

plr.CharacterAdded:Connect(function()
	plr.Character:WaitForChild("Humanoid")
	Camera.CameraType = Enum.CameraType.Scriptable
	
	Camera.CFrame = CFrame.new(105.530022, 281.960022, 98.2499924, 1, 0, 0, 0, 1, 0, 0, 0, 1)
	wait(1)
	tween2:Play()
	wait(3)
	tween3:Play()
	wait(3)
	Camera.CameraType = Enum.CameraType.Custom
	Blur.Size = 0
end)

This is the whole script.

Btw you need to make position and look at vector3 values instead of cframe since the CFrame requires vector 3’s as parameters.

It doesn’t seem like you used the code I suggested. I suggested you remove the focus part and do the position you want the camera to look at as the second parameter in the cframe. Also, have you tried
using

CFrame.new(Vector3.new(YourPosition), Vector3.new(Position you want camera to look at))

You seem to not be using Vector3.new() to specify certain positions in CFrame.new(). You need to use

CFrame.new(Vector3.new(Position for camera to be), Vector3.new(Position to look at)) -- Change pos in here to whatever you want 
--- Instead of
CFrame.new(1,1,1, 2, 2, 2) -- Complicated with a ton of commas and the script thinks these are 3 different parameters.

It still is not looking in the correct direction.

Ok update your code that you showed me with the code that you just made using my suggestions.

plr = game.Players.LocalPlayer
local Camera = workspace.CurrentCamera
local tweenService = game:GetService("TweenService")


local Blur = Instance.new("BlurEffect")
Blur.Parent = Camera
Blur.Name = "Blur"
Blur.Size = 22

local tween1 = tweenService:Create(
	Camera,
	TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
	{
		CFrame = CFrame.new(Vector3.new(105.530022, 281.960022, 98.2499924), Vector3.new(121.424995, 265.545013, 144.409988)),
		
		
	}
)

I played the tween down below.

Ok, this is in a local script right? Also try

TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)

Just in case it may fix something even though it’s highly unlikely. BTW, remove the comma at the end of your CFrame in the table since there is nothing else in the table.

It is in a local script. I will try that.

local tween1 = tweenService:Create(
	Camera,
	TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
	{
		CFrame = CFrame.new(Vector3.new(105.530022, 281.960022, 98.2499924), Vector3.new(121.424995, 265.545013, 144.409988))
	}
)

This should work.

2 Likes

I know this is like 3 years ago but, when I try this method it goes just about to the right place, but not quite.