Moving character arms to a specific position

Since I’m going to build a game (I’m usually only creating high-quality modules) I’ve been using characters for my game. I want to have a detained/arrested character effect which is working for both the rig types R6/R15 and needs to be used on NPC’s and player characters.

image
R6 example rig. Left is the usual character. Right is the ‘arrested/detained’ rig.

I want to make those character change from the server to the character and the character cannot overrule it: other animations playing. I’ll make the character unmoveable (but that’s another topic).

I’ve tried to do it with animations (for the ease of character modifications) but it’s difficult for me to let them stay all the time for both NPC and PC (Player Character). Further, it’s probably not the most reliable method.

I’ve tried to modify the arms using CFrame but it looks like it’s changing the arm to my editing position. :eyes:

workspace.ArrestRig["Right Arm"].CFrame = CFrame.new(-139.390381, 3.34176683, 42.6784096, 0.526961982, 0.734517992, 0.427544713, -0.659798026, 0.0364752039, 0.750557244, 0.535703003, -0.677608371, 0.503854454)

image
What’s that arm doing here?

1 Like

This question is treading on XY problem grounds.

X, Problem: You want to have player arms behind their back. You tried using animations but apparently didn’t get them to work out properly.

Y, Attempted Solution: Attempting to use CFrame to force player arms behind their back.

The Y, attempted solution, does not truly resolve your problem. Modifying the CFrame of the limbs still leaves them susceptible to being offset by animations and you aren’t setting them correctly either.

You should go back to using animations. As I mentioned above in the thread review, when working with limbs you are supposed to use the weld offsets (C0 and C1) with CFrames relative to the character’s torso as opposed to changing the limb’s CFrame altogether to a hardcoded world space.

It is possible to force arms to stay behind players’ backs without other animations playing over it. I’m not sure what your initial difficulty with them was though. Furthermore, animations are not unreliable, they are in fact very much reliable in terms of letting the engine handle offsets and movements.

Mind sharing the difficulties you encountered with animations? They are definitely what you’ll want in this scenario as opposed to hardcoded CFrames.

4 Likes

Thank you Colbert!

I’ve the animations ready and will try out to let them loop the first character position.

I’ll come back to you with my code sample soon!

i agree with colbert, animations are the single most reliable and easiest solution right now
how i’d tackle this would be:
having an animation that only affects the limbs, has all other body parts locked (so other animations can correctly play on them, except the arms) and having the priority set to action (which makes it so that no animaton can override the handcuffed one).
you could easly position them behind the torso in exactly any pose you want, much easier, that offset will be kept no matter what because the arms are always animated relative to the upper torso!

  • plus you get to even animate the handcuffs with small motion like breathing or natural shaking :smiley:
2 Likes

Thank you Wingboy0 and Colbert2677,

I’ve made use of animations and it succeeded!


Player1 arrested by Player2.

This is done by a RemoteEvent to an animation script in StarterCharacterScripts. It’s also having a detection between NPC’s and PC’s.
PC’s are working completely. :smiley:

NPC’s aren’t animating, sadly. This is my code:

local arrestAnimation = Instance.new("Animation")
arrestAnimation.AnimationId = "rbxassetid://4178326828"
--[
-- Arrestation script activator with some other code here. Not relevant to the topic.
--]
arrestAnimationTrack = Humanoid:LoadAnimation(arrestAnimation)
arrestAnimationTrack:Play()

It doesn’t run, not even on scriptless rigs. The animation is set on looping at the editor.

1 Like

The original case has been solved.

A good additional note from @Wingboy0:

My issue with animating NPC’s is (when you look objective) not related to this case and so off-topic. I’ve got the right advice here.

Thank you!

3 Likes