Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Locking Players Camera In Mouse Lock Angle?

I need help figuring out how I can lock a players camera in the mouse lock angle. I made a script that makes you face where your mouse is pointing

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
repeat wait() until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

game:GetService("RunService").RenderStepped:connect(function()
	if humanoid.Health > 0 then
		character.Torso.CFrame = CFrame.new(character.Torso.Position, Vector3.new(mouse.Hit.p.X, character.Torso.Position.Y, mouse.Hit.p.Z))
	end
end)

Any help finding out how to make the camera angle stay in the mouse lock angle position?

1 answer

✓ Accepted answer

I actually answered a question very similar to this a few days ago. You don't need to write a custom camera. Do what I say below to get a MouseLock Camera:

First: Play Solo, go to the Player object, and copy the CameraScript in PlayerScripts.

Second: Paste that script in StarterPlayerScripts. DO NOT rename it. There is a line in that script that removes the the original script and replaces it with this one.

Third: Open up the "RootCamera" Module. Change line 112 to this.ShiftLock = true.

Fourth (or Third pt. 2) Change line 126 to return true

Hope this helps!

1 comment

0

How would I make it possible for the player to move their mouse if needed?

This discussion is preserved as it was. New answers, comments, and votes are closed.