Need help with camera movement for jump scare

So I’m trying to make a jumpscare-ish thing and I need the player camera to turn around and look at a specific part. (Pretty sure it’s possible to have a part as a target for the camera)
I have no idea how to get started so any help is welcome.

  • Turn around about 180degrees
  • target specific part
1 Like

To target an specific part u can use:

local camera = game.WorkSpace.CurrentCamera -- Player Camera--

camera.CameraSubject = PartToFixTheCamera
2 Likes

This works but I tried something else which also works.

wait()

local character = game.Players.LocalPlayer.Character
local cam = game.Workspace.CurrentCamera

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable

while true do
	wait(0.016)
	cam.CFrame = CFrame.new((character.Head.CFrame * CFrame.new(0, 0, 0)).Position, game.Workspace.hhh.Position)
end

The camera just instantly moves to the target tho, what do you think is the easiest way to slowly tween it to the location of the target part?

Also your script is probably better so I’ll use that instead.

If u want to slowly target the part position, then make a loop that increases the camera position Until you reach the object’s position or the position u want the camera to be at

1 Like

Use TweenService to interpolate the properties of instances

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local CurrentCamera = workspace.CurrentCamera
local TweenService = game:GetService("TweenService")
local Part = workspace:WaitForChild("Part")
local tweenInfo = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0)
local Goal = {CFrame = Part.CFrame * CFrame.Angles(0,math.rad(180),0)}
local Tween = TweenService:Create(CurrentCamera, tweenInfo, Goal)

CurrentCamera.CameraType = Enum.CameraType.Scriptable
Tween:Play()
2 Likes