Im trying to tween between CFrame camerasubjects is it even possible? Ive tried to create a camera and assign the camerasubject to it, but because ROBLOX, the best developing engine, multiple cameras DONT WORK?! Script:
of course not working multiple cameras, I just need the position, which doesnt UPDATE.
“you can change the current camera’s position, not create a new one, that will implode your code” YEAH THATS WHAT I AM ASKING FOR, HOW TO GET THE CFRAME IF I CANT USE POSITION OF THE CAMERA
I change subject from humanoid to head back to humanoid and I want to smoothly change it from the head back to the humanoid, so I set the camera to scriptable and I want to tween the camera cframe to the humanoid subject cframe. Its hard to explain
“I change subject from humanoid to head back to humanoid and I want to smoothly change it from the head back to the humanoid, so I set the camera to scriptable and I want to tween the camera cframe to the humanoid subject cframe. Its hard to explain”
i made this script to move the camera smoothly between camera subjects
task.wait(1)
local RS = game:GetService("RunService")
local cam = workspace.CurrentCamera
local timeToTween = 1
local function tweenCam(newSubject)
local oldPart
local newPart
if cam.CameraSubject:IsA("Humanoid") then
oldPart = cam.CameraSubject.Parent.Head
else
oldPart = cam.CameraSubject
end
if newSubject:IsA("Humanoid") then
newPart = newSubject.Parent.Head
else
newPart = newSubject
end
local rPos = cam.CFrame.Position - oldPart.Position
local camFrame = cam.CFrame
cam.CameraType = Enum.CameraType.Scriptable
local moveCon
local totalTime = 0
moveCon = RS.RenderStepped:Connect(function(dt)
local newFrame = camFrame-camFrame.Position+newPart.Position+rPos
totalTime = math.clamp(totalTime+dt/timeToTween, 0, 1)
cam.CFrame = camFrame:Lerp(newFrame, totalTime)
if totalTime == 1 then
moveCon:Disconnect()
cam.CameraSubject = newSubject
cam.CameraType = Enum.CameraType.Custom
moveCon = nil
end
end)
repeat task.wait() until not moveCon
end
tweenCam(workspace.B)
task.wait(1)
tweenCam(game.Players.LocalPlayer.Character.Humanoid)