Help needed locking a players camera in place

Currently I’m scripting a terminal of sorts. A part is placed right in front of it. In which if the player interacts with it, their camera would be set to the part.

However, I’m unable to find a way to make it so that the player can’t rotate their camera, I saw things such as using CameraType.Fixed but that was not helped.

Help would be appreciated.

local interact = workspace.Terminal.InteractTerminal

local players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = players.LocalPlayer
local hum = player.Character.Humanoid

local camera = workspace.CurrentCamera


local function switchCamera(switch)
		player.Character.Humanoid.WalkSpeed = 0
		local pos = workspace.Terminal.CameraView
		camera.CameraSubject = pos
end

interact.OnClientEvent:Connect(switchCamera)

Try this instead:

local camera = workspace.CurrentCamera

camera.CameraType = Enum.CameraType.Scriptable

local function switchCamera(switch)
	player.Character.Humanoid.WalkSpeed = 0
	local pos = workspace.Terminal.CameraView
	camera.CameraSubject = pos
	camera.CFrame = pos.CFrame
end

I don’t think you set changed the CameraType to Scriptable, meaning anything you did to the camera most likely did nothing.

were you looking on devforum

Did this, yields same results. Sets my camera to the part but I can still move the camera around by holding right click

I have looked across the devforum, so far only just found out about using renderstepped to do this

Just tried it, renderstepped works and locks the CFrame every frame

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