- What do you want to achieve?
I want that after you trigger the proximity prompt, the camera is manipulated to a specific block and focuses on another block using TweenService
Like this:
- What is the issue?
The CFrame works but it doesn’t focus on the part that i want it to focus on.
Here is the code:
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"] = ending.CFrame,
["Focus"] = focusing.CFrame
}
local TweenMoving = TweenService:Create(ending, InfoMoving, PTMoving)
local TweenInterpolate = TweenService:Create(camera, InfoInterpolate, PTInterpolate)
local function onPromptTriggered()
camera.CameraType = Enum.CameraType.Scriptable
TweenInterpolate:Play()
wait(3)
TweenMoving:Play()
end
ProximityPrompt.PromptTriggered:Connect(onPromptTriggered)
Note: The moving part thing isn’t related to this bug.