I have a custom 3rd person camera, and I wanna be able to do animations with it, so I unbind my camera so I can then do tweens. But once said tween has finish, it justs gets reset back to the position it was before hand?
local function GetDefaultPosition()
local Character = Player.Character
if not Character then return end
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
if not HumanoidRootPart then return end
local PlayerPosition = HumanoidRootPart.Position
local CameraPosition = PlayerPosition + OFFSET
return PlayerPosition, CameraPosition
end
--// Update camera movement
local function UpdateCamera()
-- Get default position
local PlayerPosition, CameraPosition = GetDefaultPosition()
if not PlayerPosition or not CameraPosition then return end
CurrentCamera.CFrame = CFrame.new(CameraPosition, PlayerPosition)
end
function CameraController:Dialogue(npcCFrame)
RunService:UnbindFromRenderStep("Camera")
local Tween = TweenService:Create(
CurrentCamera,
TweenInfo.new(0.5),
{
CFrame = npcCFrame * CFrame.Angles(math.rad(20), math.rad(180), 0) + Vector3.new(-8, 2, 0)
}
)
Tween:Play()
end
function CameraController:Start()
CurrentCamera.FieldOfView = FOV
-- Bind camera
RunService:BindToRenderStep(
"Camera",
Enum.RenderPriority.Camera.Value,
UpdateCamera
)
end
I’ve put prints inside the UpdateCamera function, as soon as the :Dialogue is called, it stops, so the unbinding is working. Just unsure why after my tween it reverts back to its original position
Appears that the “Camera” RenderStep binding is on its own journey even after unbinding it here… Not sure why that’s happening. Maybe the “Camera” is already used or something in the game Engine or something? Looks like one of those crazy occurrences that seems to come from nowhere to me
I would recommend changing the name to something wild or using a variable that represents a string of that binding.
are you sure the cameratype is actually changed? I’ve had instances where the cameratype isn’t changed for some reason when I change the cameratype near the top of a localscript