I Have this script but it dosnt quiet seem to work, Does anybody now how to make the camera face the players face when “Focused”.
I’ve tried alot of methods but haven’t figured out how to achive this.
--// Gen Setup
local TaskingFolder = script.Parent
local Gui = TaskingFolder.Parent
--// Util Setup
local Utils = Gui:WaitForChild('Utils')
local Blur = Instance.new('BlurEffect', game:GetService('Lighting'))
Blur.Size = 0
--// Config Setup
local Configuration = require(Utils:WaitForChild('Configuration.esy'))
local FocusKeybind = Configuration.FocusKeybind
local Focused = false
--// Services
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local TweenService = game:GetService('TweenService')
local UserInputService = game:GetService('UserInputService')
--// Service(s) Child Requirements
local CurrentCamera = workspace:WaitForChild('Camera')
local OldCameraPosition = CurrentCamera.CFrame.Position -- Store the initial camera position
--// Focus Step:
UserInputService.InputBegan:Connect(function(Input, GPE)
if GPE then return end
if Input.KeyCode == FocusKeybind then
if Focused == false then
Focused = true
OldCameraPosition = CurrentCamera.CFrame.Position -- Update the old camera position when focusing
TweenService:Create(Blur, TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut), {Size = 25}):Play()
-- Calculate a new camera CFrame to look at the front of the player's face
local lookAtPosition = Player.Character.Head.Position
local cameraPosition = lookAtPosition - (CurrentCamera.CFrame.LookVector * 5) -- Adjust 5 units back
CurrentCamera.CFrame = CFrame.new(cameraPosition, lookAtPosition)
elseif Focused == true then
Focused = false
TweenService:Create(Blur, TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut), {Size = 0}):Play()
-- Return the camera to the old position
CurrentCamera.CFrame = CFrame.new(CurrentCamera.CFrame.Position, OldCameraPosition)
end
end
end)