I’m new to camera manipulation so, I don’t really know why it isn’t doing this.
- What do you want to achieve?
I want that when the focusing part moves, the camera continues to focus on the moving part.
- What is the issue?
The camera just looks at where the moving part was and never tracks the part when it moves.
- What solutions have you tried so far?
I couldn’t find anything helpful about this.
local TweenService = game:GetService("TweenService")
local ProximityPrompt = game:GetService("ProximityPromptService")
local camera = workspace.CurrentCamera
local focusing = workspace.Focusing
local ending = workspace.Ending
local Moving = workspace.Moving
local clicker = workspace.ClicktoCFrame
local Player = game.Players.LocalPlayer
local InfoMoving = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local InfoInterpolate = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local PTMoving = {
["Position"] = Moving.Position
}
local PTInterpolate = {
["CFrame"] = CFrame.lookAt(ending.Position, focusing.Position)
}
local TweenMoving = TweenService:Create(focusing, InfoMoving, PTMoving)
local TweenInterpolate = TweenService:Create(camera, InfoInterpolate, PTInterpolate)
local function onPromptTriggered()
clicker.ProximityPrompt.Enabled = false
camera.CameraType = Enum.CameraType.Scriptable
TweenInterpolate:Play()
wait(3)
TweenMoving:Play()
end
ProximityPrompt.PromptTriggered:Connect(onPromptTriggered)