Ok so the guns in my place have a crouch and prone system, and they've been working fine until the update that made the camera attached to the HumanoidRootPart. Now whenever you crouch or go prone, the camera stays in the same place. I've seen litozinnamon's Call of Robloxia 5 - Dev Tests game have the same problem but he fixed it somehow, and I don't know how to fix it. Any suggestions?
Oh and here's the block of code that controls the prone and crouch system:
if Key == "c" then
local LHip = Torso["Left Hip"]
local RHip = Torso["Right Hip"]
local Root = HRP.RootJoint
if Stance == "Stand" or Stance == "Prone" then
Stance = "Crouch"
Humanoid.WalkSpeed = (Aimed and 6 or 8)
LHip.C0 = CF(-1,-0.5,0) * CFANG(0,RAD(-90),0)
LHip.C1 = CF(-0.5,0.5,1) * CFANG(0,RAD(-90),RAD(-90))
RHip.C0 = CF(1,-0.5,0) * CFANG(RAD(-180),RAD(90),0)
RHip.C1 = CF(0.5,0.5,1) * CFANG(RAD(-180),RAD(90),0)
Root.C0 = CF(0,-1,0) * CFANG(RAD(-90),0,RAD(180))
local Connection = nil
Connection = Humanoid.Jumping:connect(function()
if Stance == "Crouch" then
onKeyDown("c")
end
Connection:disconnect()
end)
elseif Stance == "Crouch" then
Stance = "Stand"
Humanoid.WalkSpeed = (Aimed and 10 or 16)
LHip.C0 = CF(-1,-1,0) * CFANG(0,RAD(-90),0)
LHip.C1 = CF(-0.5,1,0) * CFANG(0,RAD(-90),0)
RHip.C0 = CF(1,-1,0) * CFANG(RAD(-180),RAD(90),0)
RHip.C1 = CF(0.5,1,0) * CFANG(RAD(-180),RAD(90),0)
Root.C0 = CF() * CFANG(RAD(-90),0,RAD(180))
end
end
if Key == "x" then
local LHip = Torso["Left Hip"]
local RHip = Torso["Right Hip"]
local Root = HRP.RootJoint
if Stance == "Stand" or Stance == "Crouch" then
Stance = "Prone"
Humanoid.WalkSpeed = (Aimed and 3 or 5)
LHip.C0 = CF(-1,-1,0) * CFANG(0,RAD(-90),0)
LHip.C1 = CF(-0.5,1,0) * CFANG(0,RAD(-90),0)
RHip.C0 = CF(1,-1,0) * CFANG(RAD(-180),RAD(90),0)
RHip.C1 = CF(0.5,1,0) * CFANG(RAD(-180),RAD(90),0)
Root.C0 = CF(0,-2.5,0) * CFANG(RAD(180),0,RAD(180))
Connection = Humanoid.Jumping:connect(function()
if Stance == "Prone" then
onKeyDown("x")
end
Connection:disconnect()
end)
elseif Stance == "Prone" then
Stance = "Stand"
Humanoid.WalkSpeed = (Aimed and 10 or 16)
LHip.C0 = CF(-1,-1,0) * CFANG(0,RAD(-90),0)
LHip.C1 = CF(-0.5,1,0) * CFANG(0,RAD(-90),0)
RHip.C0 = CF(1,-1,0) * CFANG(RAD(-180),RAD(90),0)
RHip.C1 = CF(0.5,1,0) * CFANG(RAD(-180),RAD(90),0)
Root.C0 = CF() * CFANG(RAD(-90),0,RAD(180))
end
end

1 comment
Make the camera frame on the head, I did that in my games i'll post an example(answer)!