A Lock On Camera

I’ve been trying to make a Lock On Camera like this.

https://gyazo.com/7005f3fe768f56ac52d4789bedd76f5a
^ Anime Cross 2

I’ve looked through a couple free model scripts but can’t seem to get the hang of it.

9 Likes

I don’t know exactly what you’re talking about but I think you can use the CameraType,
Property of Camera , for example:

local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Fixed

Or you can just set it manually I think.

2 Likes

Something you could do is, fix the camera behind the player like shown in the photo, while making the player face the part.

local uis = game:GetService("UserInputService")
local target = game.Workspace.target
local focusing = false
uis.InputBegan:Connect(function(input)
	if (input.KeyCode == Enum.KeyCode.F) then
		focusing = not focusing		
		if (not focusing) then
			game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
		else
			game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
		end
	end
end)
while game:GetService("RunService").RenderStepped:Wait() do
	if (focusing) then
		game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position,Vector3.new(target.Position.X,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y,target.Position.Z))
		game.Workspace.CurrentCamera.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame*CFrame.new(Vector3.new(7.5,2.5,10))
	end
end

It would be something like that. (i’m new to dev forum, so i’m still learning, sorry)

17 Likes

That is the same camera lock as ROBLOX’s default shift lock. It should be somewhere in the player’s camera scripts.

4 Likes

What does the variable on line 2 stand for?

1 Like

Nevermind, Thanks!

2 Likes

does this go in a tool? Where in the player does this go?
StarterScripts?

1 Like

Try putting it in the StarterPack

*StarterCharacter is better because it resets with the player.

4 Likes