So I want it to stay at the character instead of reset
Code:
local camera = workspace.CurrentCamera
local ts = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local camCFrame = camera.CFrame
local camDistance = camCFrame.Position - Player.Character:WaitForChild("Head").Position
local newPos = Player.Character:FindFirstChild("Head").Position + camDistance
local cameraCFrame = CFrame.new(newPos, newPos + camCFrame.LookVector)
script.Parent.Parent.Play.MouseButton1Click:Connect(function()
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = Player.Character:FindFirstChild("Head")
local part = Player.Character:FindFirstChild("Head") --where the part is
local TI = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
local tween = ts:Create(camera,TI,{CFrame = part.CFrame}):Play()
tween = ts:Create(camera,TI,{CFrame = part.CFrame}).Completed:Connect(function()
warn("COMPLETED")
end)
end)
Video: robloxapp-20230406-1419248