I want the camera subject to be humanoid, but when I play a crawling animation, the camera stays above my character like my head is still there.
Please tell me how I can make the camera subject down towards my head using a script.
I want the camera subject to be humanoid, but when I play a crawling animation, the camera stays above my character like my head is still there.
Place inside a LocalScript
:
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local DefaultMin = Player.CameraMinZoomDistance
local DefaultMax = Player.CameraMaxZoomDistance
function setFirstPerson(value)
if value then
Player.CameraMinZoomDistance = 0.5
Player.CameraMaxZoomDistance = 0.5
else
Player.CameraMinZoomDistance = DefaultMin
Player.CameraMaxZoomDistance = DefaultMax
end
end
--when your crouch animation plays
setFirstPerson(true)
--when your crouch animation stops
setFirstPerson(false)
I never said that I want it to force first person mode. I want the camera to move down towards where my head physically is when I crawl. I tried using camera offset but it seems like a script isn’t able to change that value.
Set the CameraSubject of the CurrentCamera property of the workspace to “Head” body part of the character when you display the animation.
workspace.CurrentCamera.CameraSubject = workspace[player].Head
That won’t work, because the camera subject has to be the humanoid otherwise the character’s body parts won’t turn invisible when you go in first person, and the head parts will me blocking your view.
I figured out that you can change the camera offset using a local script, so I set up a local StarterCharacterScript and used a remote event to set the camera offset