I have tried getting the character move direction and change the camera position.
This code is in StarterCharacterScripts(folder)
--Code
01 | local currentCam = game.Workspace.CurrentCamera |
02 | local camPart = game.Workspace.Cam |
03 | local player = game.Players.LocalPlayer |
04 | local character = player.Character |
05 | currentCam.CameraType = Enum.CameraType.Scriptable |
06 | repeat wait() |
07 | print ( "FIXING" ) |
08 | currentCam.CameraType = Enum.CameraType.Scriptable |
09 | until currentCam.CameraType = = Enum.CameraType.Scriptable |
10 | print ( "FIXED" ) |
11 | currentCam.CFrame = camPart.CFrame |
12 |
13 | while wait( 0.1 ) do |
14 | currentCam.CFrame = camPart.CFrame |
15 | if character.Humanoid.MoveDirection = = Vector 3. new( 1 , 0 , 0 ) then |
16 | camPart.Position = character.HumanoidRootPart.Position + Vector 3. new( 1 , 0 , 0 ) |
17 | end |
18 | end |
--i have solved this myself
local currentCam = game.Workspace.CurrentCamera local camPart = game.Workspace.Cam local player = game.Players.LocalPlayer local character = player.Character currentCam.CameraType = Enum.CameraType.Scriptable repeat wait() print("FIXING") currentCam.CameraType = Enum.CameraType.Scriptable until currentCam.CameraType == Enum.CameraType.Scriptable print("FIXED") currentCam.CFrame = camPart.CFrame
while wait() do currentCam.CFrame = camPart.CFrame camPart.Position = character.Head.Position + Vector3.new(0, 0, 20) end