I am trying to make a crouch script for a fps. The camera is supposed to move down and up depending if they are crouching or not.
mouse.KeyDown:Connect(function(key) if key == "c" and crouching == 1 then crouching = 2 h.WalkSpeed = h.WalkSpeed - 15 h.JumpPower = h.JumpPower - 60 playAnim:Play() cam.CFrame = cam.CFrame - Vector3.new(0,5,0) script.Parent.CrouchNonfication.Text = "Crouching" crouching = 3 elseif key == "c" and crouching == 3 then crouching = 2 h.WalkSpeed = h.WalkSpeed + 15 if p.Perk.Value == "Kangaroo" then h.JumpPower = 60 else h.JumpPower = 40 end cam.CFrame = cam.CFrame + Vector3.new(0,5,0) playAnim:Stop() script.Parent.CrouchNonfication.Text = "" crouching = 1 end end) end
One way you can do it is by setting the camera to a part that you can easily use CFrame on. PeasFactory offers a really good explanation of this that you can find here. Another way would just to keep the camera locked onto the head, which should follow your crawling animation