So, I am using this crouching script, for crouching. Although I have a slight issue, which Im not sure how to fix?
Currently, the script makes you crouch and disables collision on your humanoidrootpart,
but it doesnt move the camera down in a sense
ex; if you go into first person, you are positioned higher than your head, so your camera is basically above the player.
How do I make it so the camera is ‘lower’ per say, or is there any changes to the script I should make?
local uis = game:GetService("UserInputService")
local humanoid = script.Parent:WaitForChild("Humanoid")
local animationIdle = humanoid:LoadAnimation(script:WaitForChild("CrouchIdle"))
local animationMoving = humanoid:LoadAnimation(script:WaitForChild("CrouchMoving"))
local crouching = false
uis.InputBegan:Connect(function(inp, processed)
if processed then return end
if inp.KeyCode == Enum.KeyCode.C then
crouching = not crouching
end
end)
game:GetService("RunService").Heartbeat:Connect(function()
script.Parent.HumanoidRootPart.CanCollide = false
if crouching then
humanoid.WalkSpeed = 6.5
animationIdle:Play()
if humanoid.MoveDirection.Magnitude > 0 then
if not animationMoving.IsPlaying then animationMoving:Play() end
else
animationMoving:Stop()
end
else
animationIdle:Stop()
animationMoving:Stop()
humanoid.WalkSpeed = 10
end
end)```