Camera Manipulation Problem

Hello.
I’m attempting to create a camera that faces the mouse’s position.

Camera.CameraType = Enum.CameraType.Scriptable



RSS.RenderStepped:Connect(function(Delta)
	

	local NewCamCFrame = CFrame.new(script.Engines.Value.Parent.Parent.CriticalStructure.ThirdView.CFrame.p, Vector3.new(Mouse.Hit.p.X,Mouse.Hit.p.Y,Mouse.hit.p.Z))
	
	script.Engines.Value.Parent.Parent.CriticalStructure.ThirdView.CFrame:Lerp(NewCamCFrame, 1)	
	print(NewCamCFrame)
	Camera.CFrame = script.Engines.Value.Parent.Parent.CriticalStructure.ThirdView.CFrame

	
	
end)

So basically I have a part, that I then use as a “camera”. This part will later on be moving, as it apart of an aircraft. I want this part to face the player’s mouse, and lerp to its Hit, so that the player camera will face it.

But when I test play, the camera stays the same.

I can provide more information if necessary.

Is your game R6 or R15? I would like to know that to help you.

I think your game is in R6, so i hope this will help you.

local Player = game:GetService("Players").LocalPlayer or game:GetService("Players").PlayerAdded:Wait()

local Character = Player.Character or Player.CharacterAdded:Wait() or workspace:FindFirstChild(Player.Name)

local Torso = Character:WaitForChild("Torso")

local Neck = Torso:WaitForChild("Neck")

local LeftShoulder = Torso:WaitForChild("Left Shoulder")

local RightShoulder = Torso:WaitForChild("Right Shoulder")

local Humanoid = Character:WaitForChild("Humanoid")

local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

local Mouse = Player:GetMouse()

local CurrentCamera = workspace.CurrentCamera

local RC0 = CFrame.new(1, .5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)

local RC1 = CFrame.new(-.5, .5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)

local LC0 = CFrame.new(-1, .5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)

local LC1 = CFrame.new(.5, .5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)

local NeckC0 = Neck.C0

local NeckC1 = Neck.C1

Humanoid.AutoRotate = false

game:GetService("RunService").RenderStepped:Connect(function()

local Maths = CFrame.Angles(0,0,math.asin(Mouse.Origin.LookVector.Y))

RightShoulder.C1 = RC1 * Maths:inverse()

LeftShoulder.C1 = LC1 * Maths

Neck.C0 = NeckC0 * CFrame.Angles(math.asin(Mouse.Origin.LookVector.Y), 0, 0):inverse()

HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, Vector3.new(Mouse.Hit.p.x, HumanoidRootPart.Position.Y, Mouse.Hit.p.z))

end)

I just remade your script to make camera aim at mouse direction, if you need something more just let me know! Good luck.

1 Like

Thanks for the reply.
I wrote the question a little confusing i realise now. Let me rephrase it.
The part named ThirdView is attached to a aircraft model. When the aircraft moves, the part follows. What i want the script to do is have the part face the player mouse Hit, which in turn will make the player camera thats attached to it face the player mouse Hit. If that makes any sense lol

Copy that, and then instead using HumanoidRootPart.CFrame, customize it with your brick properties!

@EncodedCheetah
It kinda worked, and it kinda didn’t work.