Hey there! I’m making a parkour game, and I am trying to add guns. Everything works fine, until I try to set the CFrame of the viewmodel arms to the CFrame of the player’s arms.
viewmodel["Right Arm"].CFrame = character["Right Arm"].CFrame
viewmodel["Left Arm"].CFrame = character["Left Arm"].CFrame
if idleAnim.IsPlaying then
idleAnim:Stop()
end
That piece of script is inside a RenderStepped loop.
I’ll gadly provide more information if you need it. Any help is appreciated!
No, there are not. The arms are both connected to a torso using a Motor6D. The torso is then connected to a RootPart. The torso’s CFrame is not being changed at all, and no animations are being played.
The script example you showed wasn’t very helpful, although can you check and debug to see what the character looks like, since you are moving both the left and right CFrame of the viewmodel onto the character, can you check to see if the character’s animation or pose is causing it?
The character is not what is causing this. Here is some more code that might be helpful:
runService.RenderStepped:Connect(function(deltaTime)
currentDeltaTime = deltaTime
if canAttach and not isLedgeGrab.Value and not isWallrunning.Value then
if not idleAnim.IsPlaying then
idleAnim:Play()
end
if humanoid.MoveDirection.Magnitude > 0 then
local a = .05
local b = .1
local t = tick()
local dt = 1/10
local X = b * math.sin(t*9)
local Y = a * math.cos(t*18)
local Z = 0
CF = CF:Lerp(CFrame.new(X, Y, Z), 1-.01^deltaTime)
walkCFrame = walkCFrame:Lerp(CFrame.new(0,0,.2), 1-.01^deltaTime)
t += dt
else
CF = CF:Lerp(CFrame.new(0,0,0), 1-.01^deltaTime)
walkCFrame = walkCFrame:Lerp(CFrame.new(0,0,0), 1-.01^deltaTime)
end
local velocity = humanoid.RootPart.Velocity
local finalOffset = CFrame.new(0,-1.5,-.5) * walkCFrame * CF
local speed = 1
local modifier = 0.05
local mouseDelta = game:GetService("UserInputService"):GetMouseDelta()
swaySpring:shove(Vector3.new(mouseDelta.x / 2000,mouseDelta.y / 2000))
local swayCFrame = swaySpring:update(deltaTime)
local walkCycle = movementSpring:update(deltaTime)
viewmodel.PrimaryPart.CFrame = cam.CFrame:ToWorldSpace(finalOffset)
viewmodel.PrimaryPart.CFrame = viewmodel.PrimaryPart.CFrame * CFrame.Angles(0,-swayCFrame.x,swayCFrame.y)
cam.CFrame = cam.CFrame
elseif canAttach and isLedgeGrab.Value then
viewmodel["Right Arm"].CFrame = character["Right Arm"].CFrame
viewmodel["Left Arm"].CFrame = character["Left Arm"].CFrame
if idleAnim.IsPlaying then
idleAnim:Stop()
end
elseif canAttach and isWallrunning.Value then
viewmodel["Right Arm"].CFrame = character["Right Arm"].CFrame
viewmodel["Left Arm"].CFrame = character["Left Arm"].CFrame
if idleAnim.IsPlaying then
idleAnim:Stop()
end
end
end)
Both of the .Value’s are correct.
Edit:
The directory if that is helpful whatsoever: