How to make Player camera point to a part repeatly?

Hello, So basically I’m trying to make a jumpscare script and the issue I’m having is when the camera CFrame won’t change to the Jumpscare Camera CFrame. What I mean is the Jumpscare Part also move and is animated but when I’m calling the Cutscene event it won’t change the camera Cframe but only once.

Is there a way i could make it so that the camera CFrame is always on the jumpscare part cframe?

local Hum = script.Parent.Zombie
local Animator = Hum.Animator
local JumpscareAnim = script.Parent.Jumpscare
local Track = Animator:LoadAnimation(JumpscareAnim)
local Db = false
local CutsceneEvent = game.ReplicatedStorage.Events.CutsceneControl

script.Parent.Torso.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		Hum.WalkSpeed = 0
		if not Db then
			Db = true
			CutsceneEvent:FireAllClients("Start",hit.Parent.Head,script.Parent.Head.JumpscareCamera,0.5)
			Track:Play()
			Track.Stopped:Wait()
			task.wait(.2)
			hit.Parent.Humanoid:TakeDamage(100)
			task.wait(5)
			CutsceneEvent:FireAllClients("Stop")
			Db = false
			Hum.WalkSpeed = 11
		end
	end
end)```

Show the local script.

Chars here

You mean the cutscene event or something?

Ye, then LocalScript that handle cutscene.

Wouldn’t changing the camera type to scriptable and setting the CFrame makes it unmovable? Or after running the cutscene and when the camera is pointing towards the target position then just set it to fixed?

I don’t know since i rarely touch scripting that include camera

local CameraEvent = game.ReplicatedStorage.Events:WaitForChild("CutsceneControl")
local TweenService = game:GetService("TweenService")
local Camera = game.Workspace.Camera
local Player = game.Players.LocalPlayer
local PlayerCharacter = Player.Character or Player.CharacterAdded:Wait()

local function TweenCamera(point1,point2,CutsceneTime)
	local tweenInfo = TweenInfo.new(
		CutsceneTime,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.In,
		0,
		false,
		0
	)
	
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = point1.CFrame
	
	local Tween = TweenService:Create(Camera,tweenInfo,{CFrame = point2.CFrame})
	Tween:Play()

end```

Oh, that’s fine. You can set the camera type to fixed and the player won’t be able to move it.

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Fixed
--local script

Do fixed make it so that camera point toward the jumpscare part continously?

Sorry for the late reply, what do you mean by continuously? Do you mean like it wouldn’t move and just point at the jumpscare until it ends?

The player camera CFrame will keep following and move to the jumpscare part CFrame though the position of it is changed.

Oh, I get it now. Is the Jumpscare CFrame from a part and the part is moving, but the tweening doesn’t follow when you move the Jumpscare part?

Sorry for late respond. But hey I already fixed the camera issue by creating new event to toggle the jumpscare and use renderstepped to make it so it keep facing the front surface of the jumpscare part.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.