How can I add in a Tween to make this Camera slide smoother?

local cameraMove = true

– Slide Camera
local function slideCamera()
if cameraMove then
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(Vector3.new(-5.5, 3.435, -36.605),Target.Position)
end
end

openInventoryButton.MouseButton1Click:Connect(slideCamera)

local newCFrame = CFrame.new(Vector3.new(-5.5, 3.435, -36.605),Target.Position)
local timefortween = 3
game:GetService("TweenService"):Create(camera, TweenInfo.new(timefortween), {CFrame = newCFrame}):Play()
1 Like

I found this script,
but it rotates the camera 180 degrees which I don’t want it to do…

local tween_info = TweenInfo.new(2, Enum.EasingStyle.Linear) --//the first index being the time of the tween
local camera = workspace.CurrentCamera

local function Tween_Camera(point) --//‘point’ being a CFrame

camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(camPart.CFrame.Position,Target.Position)
local property_goals = {CFrame = point} --//Goals we want the properties of 'camera' to achieve.
local new_tween = tweenService:Create(camera, tween_info, property_goals)

new_tween:Play()

end

openInventoryButton.MouseButton1Click:Connect(function()

Tween_Camera(CFrame.new(-5.5, 3.435, -36.605))

end)

1 Like

so is that just going to replace the everything i have so far or is it getting added in?

no keep variables that reference your stuff camera and Target
just put add the variables i typed in and replace the camera.CFrame line with that

It works beautifully bro thank you so much, I tried two days to do it myself but finally I had to ask for help, you came through for me thx

1 Like

no problem, use this if you want to learn more about tweens/tweenservice: TweenService

1 Like