How could I edit this to manipulate the camera?

  1. I’m currently creating a crawl script but I’m in first person and trying to manipulate the script so I need help.

  2. My problem is that I’m not that good at scripting and I have no CFrame or Vector3 knowledge.

  3. I have tried vector3 and CFrame tutorials but I do not know how to structure them into this script.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Animate 
local Humanoid = player.Character:FindFirstChild('Humanoid')

mouse.KeyDown:Connect(function(Key) 
	if Key == "c" then
		local Animation = Instance.new("Animation", player.Character)
		Animation.AnimationId = "rbxassetid://5816080648"
		Animate = Humanoid:LoadAnimation(Animation)
		Animate:Play()
	
		
	end  
end)

mouse.KeyUp:Connect(function(Key)
	if Key == "c" then
		Animate:Stop()
	end
end)

Thank you if you have read all the way down here.

Manipulate the camera? What do you want it to look like? There are many ways to manipulate the camera. There’s Humanoid.CameraOffset (to move the camera a bit from its current position), There’s CameraSubject, CameraType, and Camera.CFrame.
Not sure if CFrame is the same, but Vector3 is like an array of 3 numbers (x,y,z) that you can’t enter more than 3 numbers in it, a vector in 3D space. I know it’s mostly used for positions, orientations, and forces.
CFrame is like a 3D position and orientation.
Like a person that stands on Point A and looks towards Point B, the Position is Point A, and the rotation is towards point B.

Humanoid.CameraOffset
Camera.CameraSubject
Camera.CameraType
Enum.CameraType
Camera.CameraSubject
Camera.CFrame

Vector3
CFrame

Camera Manipulation

1 Like

I have a question. Are you having trouble getting the player to crawl, or is it just the camera when your in first person?

Well, it’s none of those.
I’m trying to structure in a camera so I can see from the position the player is crawling from.

1 Like

I think it’s Humanoid.CameraOffset that I am thinking of.

Yes it is, change the Y of the CameraOffset to be lower until it’s on the right position.
For example:

Humanoid.CameraOffset = Humanoid.CameraOffset - Vector3.new(0,2,0)

Change the 2 to the number that puts you in the right position

1 Like

Maybe if you make the camera focus on the player and change the y offset?

That works, but the thing is that once I press “c” It lowers everytime I press it.
Do I do the same thing at the end but with the default so it goes back to default after the player has stopped pressing c?

1 Like

Just change the - to + on KeyUp.
When the player presses C again/stops holding, just increase it by 2 again.

mouse.KeyUp:Connect(function(Key)
	if Key == "c" then
		Animate:Stop()
		Humanoid.CameraOffset = Humanoid.CameraOffset + Vector3.new(0,2,0) --Increase it by 2 now
	end
end)
1 Like

I believe so. Change the offsets until you get the camera in the place you want.

Yes! Thank you for your help.
I really appreciate this!

1 Like